I have been followed many tutorials to understand the pointer and memory allocation. The explanation given in the book is difficult to understand
Pointer is used to store the address of another variable
Memory allocation has types;
for example if I declare int variable it means compiler will allocate memory space to store the value of integer variable.
Let's suppose the memory allocate by compiler is 0001 and the value of variable is 1. it means variable value 1 stored at memory 0001 at compile time
it's little bit difficult for me to understand memory allocation for pointer. I want to understand what this is relation between pointer and dynamic memory allocation. It will be very much appreciated if someone give advice on Pointer and dynamic memory allocation.
Pointer is used to store the address of another variable
Memory allocation has types;
- Static Memory Allocation: The program is allocated memory at compile time.
- Dynamic Memory Allocation: The programs are allocated with memory at run time.
Code:
main ()
{
int variable = 1;
}
Let's suppose the memory allocate by compiler is 0001 and the value of variable is 1. it means variable value 1 stored at memory 0001 at compile time
it's little bit difficult for me to understand memory allocation for pointer. I want to understand what this is relation between pointer and dynamic memory allocation. It will be very much appreciated if someone give advice on Pointer and dynamic memory allocation.