Hello everyone
This is all about learning the operation of the C language. I understand that to store any variable we have to allocate memory.
Compiler will allocate memory for variable x when it compiles this line in program. This is a static memory allocation and the address of the variable x will not change.
Compiler will allocate memory for variable p when it compiles this line in program. This is a static memory allocation and the address of the variable will not change.
I read that the memory for m will be allocated at run time. I don't understand what happens if this line will compile only.
Will the memory be allocated for the variable m when the compiler compiles this line or memory will be allocated for variable m when code will compile and run on the target system?
This is all about learning the operation of the C language. I understand that to store any variable we have to allocate memory.
C:
int x;
C:
int * p;
C:
int *m = malloc(sizeof(int));
Will the memory be allocated for the variable m when the compiler compiles this line or memory will be allocated for variable m when code will compile and run on the target system?