C Program to Implement Structure with Pointers

include

struct student
{
char name[30];
int rollno;
float marks;
};
void display(struct student *);
void main()
{
struct student s1 = {“Raja”, 538, 92};
display(&s1);
getch();
}
void display(struct student *ptr)
{
printf(“Student name\tRollno\tMarks\n”);
printf(“%s\t\t%i\t%f”,ptr->name,ptr->rollno,ptr->marks);
}

OUTPUT:
Student name Rollno Marks
Raja 538 92.000000

Leave a Reply

Your email address will not be published. Required fields are marked *