what is pointer to strutures in c with detailed example

Answer:
pointer which holds address of a structure is known as pointer to structure.
Example:

typedef struct jayawardene{
double mendis;
int *muralitharan;
}thushara;
void main(){
static int num=22;
thushara paranavitana={6.,&num};
thushara *kulasekara;
kulasekara=¶navitana;
clrscr();
printf("%d",*kulasekara->muralitharan);
getch();


}

Output: 22
Explanation:
Here kulasekara is pointer to structure jaywardene.

Post a Comment