Hi, I have a little problem with this code. When I try to run it, only asks my to write the name (nombre), and jumps to the address (direccion) of the person number 2. Why is happing that?
Code:
int main(int argc, char* argv[])
{
struct persona{
char nombre [65];
char direccion[65];
int telefono;
}gente[5];
int a=0, b=0;
do{
a++;
printf("\nPersona %i\n--------------------", a);
printf("\nIntroduzca el nombre de la persona: ");
scanf("%c", &gente[b].nombre);
printf("\nIntroduzca la direccion de la persona: ");
scanf("%c", &gente[b].direccion);
printf("\nIntroduzca el telefono de la persona: ");
scanf("%i", &gente[b].telefono);
b++;
}while (a < 5);
getch();
return 0;
}
Thanks,