POINTER IN STRUCTURE

#include<stdio.h>

int main()

{

struct book

{

  char name[25];

  char other[25];

  int pages;

};

  struct book b1={“let us c”, “npk”, 550};

  structure book *ptr;

  ptr=&b1;

  printf(“%s %s %d/n”, b1.name, b1.other, b1.pages);

  printf(“%s %s %d/n”,ptr->name, ptr->other, ptr->pages);

  return 0;

}

Summary

1.a structure is usually used when we wish to store dissimilar data together.

2.structure elements can be access through structure variable using a dot (.) operator.

3.structure element can be access through pointer to a structure using arrow (-