Structure & pointer
#include <stdio.h>
#include <conio.h>
struct record
{
char name[20];
int roll;
};
struct record r,*p;
void main()
{
p=&r;
printf("\nEnter the name\n");
scanf("\n%s",&p->name);
printf("\nEnter the roll no\n");
scanf("%d",&p->roll);
printf("\n%s",p->name);
printf("\n%d",p->roll);
getch();
}
No comments:
Post a Comment