Pointer in Structure
Pointers in structure behave the same way as normal pointers i.e. they store the address of the variable according to its defined type.The only difference is that they are accessed using the structure variable.
/*
http://www.ProbCOMP.com
Pointers in structure behave the same way as normal pointers i.e. they store the address of the variable according to its defined type.
The only difference is that they are accessed using the structure variable.
*/
#include<stdio.h>
struct date
{
int *day;
int month;
int year;
};
void main()
{
struct date d;
int day;
printf("enter day : ");
scanf("%d",&day);
d.day=&day;
printf("enter month: ");
scanf("%d",&d.month);
printf("enter year: ");
scanf("%d",&d.year);
printf("The date is %d / %d / %d ",*d.day,d.month,d.year);
}
Download Program


