Monday, 23 February 2015

Pointers To Structure in C


/* Pointers To Structure */

#include<stdio.h>
#include<conio.h>
struct Student
{
int eno;
char name[50];
int age;
};
main()
{
int i=0;
struct Student *s;
clrscr();

printf("\n Enter Entrollment No :");
scanf("%d",&s->eno); /* ->  Member Access Operator */
printf("\n Enter Your Name :");
scanf("%s",&s->name);
printf("\n Enter Your Age :");
scanf("%d",&s->age);

printf("\n Entrollment No :%d",s->eno);
printf("\n Your Name :%s",s->name);
printf("\n Your Age :%d",s->age);

getch();
}

No comments:

Post a Comment