Does it mean C first allocates memory to variable ‘a’ and then what ever there is at that memory location becomes value of ‘a’?
Exactly!
Basically, C doesn’t do anything you don’t tell it to. That’s both its strength and its weakness.
More Related Contents:
- How dangerous is it to access an array out of bounds?
- String literals: Where do they go?
- Getting a stack overflow exception when declaring a large array
- Determine size of dynamically allocated memory in C
- Difference between static memory allocation and dynamic memory allocation
- Where in memory are my variables stored in C?
- Order of local variable allocation on the stack
- Does stack grow upward or downward?
- “register” keyword in C?
- Returning local data from functions in C and C++ via pointer
- How is malloc() implemented internally? [duplicate]
- How much memory would be freed if pointer is changed in C?
- Pointer address in a C multidimensional array
- Obtaining peak bandwidth on Haswell in the L1 cache: only getting 62%
- Segmentation Fault when writing to a string [duplicate]
- Measuring Cache Latencies
- Should I free char* initialized using string-literals?
- malloc(sizeof(int)) vs malloc(sizeof(int *)) vs (int *)malloc(sizeof(int))
- If free() knows the length of my array, why can’t I ask for it in my own code?
- How are variable names stored in memory in C?
- Memory usage of current process in C
- dynamic allocating array of arrays in C
- Malloc vs custom allocator: Malloc has a lot of overhead. Why?
- Determining Stack Space with Visual Studio
- Why does “memset(arr, -1, sizeof(arr)/sizeof(int))” not clear an integer array to -1?
- Force free() to return malloc memory back to OS
- How to determine if memory is aligned?
- C: pointer to array of pointers to structures (allocation/deallocation issues)
- How to modify memory contents using GDB?
- How many chars can be in a char array?