I just started to play C and I bump into this problem. Here's my code:
#include<stdio.h>
#include<conio.h>
struct person {
int i;
char name[100];
};
int main() {
struct person p[2];
clrscr();
for(int i=0;i<2;i++) {
printf("Enter i:\n");
scanf("%d",&p[i].i);
printf("Enter name:\n");
gets(p[i].name);
}
for(int j=0;j<2;j++) {
printf("ID: %d, Name: %c\n", p[j].i,p[j].name);
}
getch();
return 0;
}
Here's a sample ouput:
The problem is, all char members are not being asked for a value.
UPDATE:
btw, I am using Turbo C++ version 3 compiler.