After I formatted the \"direccion\"\'s scanf in function \"leerdatos\", it skip the \"nro_corredor\" in the second \'for\' loop.
I\'ve already read the related quest
#include
struct s_tiempo
{
int minutos;
int segundos;
};
struct carrera
{
int nro_corredor; // guarda nro de corredor
struct s_tiempo tiempo; // guarda el tiempo que tardo el corredor
};
struct datos
{
int nro_corredor; // guarda nro de corredor
char apellido[20];
char nombres[20];
char direccion[30];
};
bool leerdatos( struct datos *); //declaro la funcion leer
int main (void)
{
int cp; //cantidad de participantes.
printf("Ingrese la cantidad de participantes: ");
if( 1 != scanf(" %d",&cp) )
{
perror( "failed getting participantes using scanf()");
return( 1 );
}
// implied else
struct datos corredor[cp];
struct carrera carreras[cp]; // should get compiler warning due to this not being used
printf("A continuacion, ingrese los datos de los corredores: \n");
for(int i=0;i