Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write a c program to store and print name,address,roll.no of
a student using structures?

Answer Posted / raj

#include<string.h>
#include<conio.h>
#include<stdio.h>
struct student
{
char name[20],adr[5][10];
int no;
}s;
main()
{
int i,j;
clrscr();
scanf("%d",&s.no,printf("enter no of the student:"));
scanf("%s",s.name,printf("enter name of student:"));
printf("enter address(5 lines):\n");
for(i=0;i<=5;i++)
{
j=0;
while((s.adr[i][j++]=getchar())!='\n');
}
printf("\nstudent details are:\n\nRoll.no: %d\n\nName :
%s\n\nadress:",s.no,s.name);
for(i=0;i<=5;i++)
printf("\t%s",s.adr[i]);
getch();
}

Is This Answer Correct ?    33 Yes 28 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain indirection?

1076


What is the size of enum in c?

1080


What is the difference between arrays and pointers?

1087


What are the types of assignment statements?

1032


What are the advantages of the functions?

1111


Can 'this' pointer by used in the constructor?

1056


What do you understand by friend-functions? How are they used?

1173


What does c value mean?

1137


What is function prototype?

1083


Can we replace the struct function in tree syntax with a union?

1257


What are the main characteristics of c language describe the structure of ac program?

1170


What is the difference between char array and char pointer?

1006


What is the difference between class and object in c?

1117


Explain what is wrong with this statement? Myname = ?robin?;

1543


How do you define a string?

1064