Relation between Pointers and Structures in C Language
Relation between Pointers and Structures in C :-- struct inventory { char name[30];
- int number;
- float price; }
- product[2],*p;
- p = product; // assign zeroth element
- p -> name is same as (*p).name
- ++ptr->count increments count
- (++ptr)->count increments ptr and then return count
- ptr++->count is legal and increments ptr after accessing count
- *ptr->p fetches whatever p points to
- *ptr->p++ increments p after accessing whatever it points to
- (*ptr->p)++ increments whatever p points to
- *ptr++->p increments ptr after accessing whatever it points to
No comments:
Post a Comment