HOME

Thursday, April 2, 2015

C PROGRAM TO DISPLAY DATA USING POINTER TO STRUCTURE

#include<stdio.h>
#include<conio.h>
struct student
{
    char name[20];
    int roll,age;
};
void main()
{
    struct student s,*p;
    p=&s;
    printf("enter the name\n");
    scanf("%s",p->name);
    printf("enter the roll no\n");
    scanf("%d",&p->roll);
    printf("enter the age\n");
    scanf("%d",&p->age);
    printf("name\troll no\tage");
    printf("\n%s\t%d\t%d\n",p->name,p->roll,p->age);
}

No comments:

Post a Comment