Pointers to structures may be declared as we declare pointers to any other data type. Like arrays and functions, the name of structure carries the address of the structure where the values of its various members are stored. Therefore, the pointer may be initialized by the name of structure which is a constant pointer to the structure. Program illustrates the declaration and use of pointer to a structure.
# include <stdio.h> struct Health // structure declaration { char Name[20]; int Age; int Height; int Weight; } ; // end of structure void main () { struct Health S1 = {"Dinesh", 36, 179, 72}, *S; clrscr(); S = &S1; // S is assigned the address of S1 printf("Address of S1 = %X\n", &S1); printf("Size of S1 = %u\n", sizeof(S1)); printf("Value of S = %X\n", S); printf ("Size of S = %u\n", sizeof(S)); printf("Name of student= %s\n", S-> Name); printf("Ages of S1 = %d\n", S ->Age); printf("Height of S1 = %d\nWeight = %d\n", S->Height,S-> Weight); }