In book Head First C, it says that the computer does not allocate memory for variable name of an array. I got confused! Is this really true?
But if it has a memory, why can I not assign another array to this one?
In book Head First C, it says that the computer does not allocate memory for variable name of an array. I got confused! Is this really true?
But if it has a memory, why can I not assign another array to this one?
A computer program is an abstraction which describes the functionality you wish to perform. A compiler takes your description and translates it into machine code for the computer to execute.
A metaphor:
I tell you "Walk two blocks and turn left walk one block". You can then get to the store. I could also have said "Walk till you see the blue building on the left, turn 270 degrees and walk till you see the store". In both cases you will do the same thing but the instructions (program in this metaphor) are the totally different, have a different number of characters and verbs, etc.
A computer program in C is the same -- it does not matter what you name the variables -- the code that the computer will actually run will take up the same space if you call a variable "a" or if you call the variable "aVeryLongVariableName". The compiler will keep track of the names but the final output will be the same.
The identifier you are using to name an array is a pointer which actually holds the base address(Address Of First Element) of that array .
So, you can assign this address to another pointer , but assigning it to another arrays base address is not legal