Pointer to structure in c programming | CTechnotips

Pointer to structure: A pointer which is pointing to a structure is know as pointer to structure.

Examples of pointers to structure: 

What will be output if you will execute following code?


struct address{
char *name;
char street[10];
int pin;

int main(){

printf("%s %s",p->name,(*p).street);

return 0;

Output: K.Kumar H-2

p is pointer to structure address.
-> and (*). Both are same thing. These operators are used to access data member of structure by using structure’s pointer.


Post a Comment