Why My C program is not working properly
#include <stdio.h> typedef struct students { char name[20]; int id; } s1; int main(){ s1 detail[3]; for(int i=0;i < 3;i++){ printf("Enter Student %d Name : ",i+1); gets(detail[i].name); printf("Enter Student %d id : ",i+1); scanf("%d",&detail[i].id); } for(int i=0;i < 3;i++){ printf("Student %d Name is : %s",i+1, detail[i].name); printf("Student %d id is : %d\n",i+1, detail[i].id); } return 0; } // In this program when you get second or third time name or any character it will not take why // When I take char array with scanf it works but with scanf we can't take spaces or full name // When you take only character array in for loops gets function working properly // Why this function is not working in when I use multiple data type // Please tell me