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
Explain indirection?
What is the size of enum in c?
What is the difference between arrays and pointers?
What are the types of assignment statements?
What are the advantages of the functions?
Can 'this' pointer by used in the constructor?
What do you understand by friend-functions? How are they used?
What does c value mean?
What is function prototype?
Can we replace the struct function in tree syntax with a union?
What are the main characteristics of c language describe the structure of ac program?
What is the difference between char array and char pointer?
What is the difference between class and object in c?
Explain what is wrong with this statement? Myname = ?robin?;
How do you define a string?