Here the gets
function is not advancing as the i
is increasing from 0 to 3. I want to store data for 3 emps
, but when the for
loop started it takes the gets
statement takes the input but as i
increases 1,2 the gets function is not taking the input the next line of code is displayed without execution of gets
statement.
#include <stdio.h>
struct emps
{
char name[20];
char lic_no[10];
};
int main()
{
struct emps e[3];
int a;
for (int i = 0; i < 3; i++)
{
printf("enter your name\n");
gets(e[i].name);
printf("enter the license number\n");
scanf("%s", &e[i].lic_no);
}
return 0;
}