#include
struct student
{
int rollno;
char name[20];
};
void main()
{
struct student s1={123,"mahesh"};
struct student *sptr;
clrscr();
sptr=&s1;
printf("\nThe details with the help of structure variable.....\n\n");
printf("The roll number of the student is%d\n\n",s1.rollno);
printf("The name of the student is%s\n\n",s1.name);
printf("\nNow the details with the help of pointer.....\n\n");
printf("\nThe roll number of the student is%d\n\n",sptr->rollno);
printf("The name of the student is %s\n\n",sptr->name);
getch();
}
OUTPUT
The details with the help of structure variable....
The roll number of the student is123
The name of the student is mahesh
Now the details with the help of pointer.....
The roll number of the student is123
The name of the student is mahesh
No comments:
Post a Comment