This section illustrates you the concept of Structure Pointer in C. You can see in the given example, we want to access the employee's information through structure pointer. For that, we declare the structure type st consisting of members id, name and address. Then we have declared a structure pointer as:
struct st employee, *stptr;
We point the pointer to employee with the expression stptr = &employee. Then access the given members by de-referencing the pointer. For this, we have used another structure selection operator which works on pointers to structures. If p is a pointer to a structure and m is a member of that structure, then p->m. We set the values of specified members as:
stptr->id = 1;
stptr->name = "Angelina";
Here is the code:
Output will be displayed as:
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.