Monday, 23 February 2015

Typedef Structure in C


/* Typedef in Structure */

#include<stdio.h>
#include<conio.h>
typedef struct
{
int eno;
char name[50];
int age;
}Student;

main()
{
int i=0;

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