I present my problem, I have this struct:
typedef struct
{
char nombre[20];
unsigned int dni;
tfecha nac;
}tperfil;
typedef struct
{
int d, m, a;
}tfecha;
of which I have an array of the same and the idea of the counter is to brake when it encounters a 99 in the field DIA (a [u] .nac.d). Since I previously have code that adds 99 to the DIA field when there is no more data to be able to make a control cut.
int control(const tperfil a[])
{
int u = 0;
printf("%u %i\n", a[15].nac.d, u);
while(a[u].nac.d < 99)
{
printf("%u %i\n", a[u].nac.d, u);
u++;
}
return u;
}
I already know that in the a [15] there is a 99 in that field, the problem that appears is that as you can see in the first printf, it shows me the 99 as it should be, but the second printf that is the who shows me the tour shows me:
23 0
14 1
4 2
25 3
12 4
22 5
31 6
17 7
22 8
4 9
2 10
23 11
15 12
14 13
14 14
420070599 0
23 0
14 1
4 2
25 3
12 4
22 5
31 6
17 7
22 8
4 9
2 10
23 11
15 12
14 13
14 14
I do not understand why in position 15 he reads me that number and not the 99 that he showed me correctly before. The crashea program.