#include<stdio.h>
#include<conio.h>
struct record_ko
{char name[20];
int stno;
char fav_color[20];
}record[5];

void main()
{clrscr();
int no;
for(int i=0;i<5;i++)
{printf("\nwhats your name? ");
scanf("%s",record[i].name);
printf("what is your student number?? ");
scanf("%d",&record[i].stno);
printf("what is your favorite color? ");
scanf("%s",record[i].fav_color);
}
for(i=0;i<5;i++)
{printf("\nname:%s\t\t\t \nstudent no:%d\t\t\t \nfavorite color:%s\t\t",record[i].name,record[i].stno ,record[i].fav_color);
}
getch();
}

Recommended Answers

All 2 Replies

I hope you may help me to give the output...
because.. many errors occurs,..

thank you.

You can't define variables in the for loop header, so you need to put int i; somewhere else.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.