Structure in C

structuregd.html
#include<stdio.h>
#include<conio.h>
//structure is instructed........
struct students
{
	int s_n;
	char name[50];
	char address[30];
	
};
struct students stds[20];
void main()
{
	int a;
	for(a=0;a<5;a++)
	{
		printf("\nenter the name of the student:");
		scanf("%s",stds[a].name);
		printf("\nEnter the address of the student:");
		scanf("%s",stds[a].address);
		printf("\nEnter the roll numner of the student:");
		scanf("%d",&stds[a].s_n);
	}
	for(a=0;a<5;a++)
	{
		printf("\nentered  name of the student is:%s",stds[a].name);
		printf("\nEntered  address of the student is:%s",stds[a].address);
		
		printf("\nEntered the roll numner of the student is:%d",stds[a].s_n);
		getch();
	}
}

0 Comments