Tuesday 5 March 2013

Program to understand Pointers to Structures

#include<stdio.h>
#include<conio.h>
struct student
{
char name[20];
int rollno;
int marks;
};
main( )
{
struct student stu = {"Mary", 25, 68};
struct student *ptr = &stu;
printf("Name  - %s\t", ptr->name);
printf("Rollno  - %d\t", ptr->rollno);
printf("Marks  - %d\n", ptr->marks);
getch();
}

No comments:

Post a Comment