I have been trying to understand Pointer to structure for a long time But even after spending a lot of time on google search it. I don't understand it. I hope somebody help me
What I don't understand, I will tell you through the program given bellow.
Code:
#include<stdio.h>
#include<stdlib.h>
struct STRUCTURE
{
int X ;
};
int main ()
{
struct STRUCTURE *POINTER = malloc(sizeof(*POINTER)); /* Allocate dyanamic memory */
POINTER -> X = 20;
return 0;
}
In the program , I have declared the structure above the main function.
In main function there is pointer to structure I think malloc function allocate address and store in variable POINTER.
Pointer is used to hold the address of another variable.
The variable POINTER, Whose address of another variable does it store ?
How many address malloc function allocate ?
Thank you
Rahul