Dear All,
I have a question about array which let me confused and I think it needs deep understanding of arrays.
I would like to know why it is possible to use array of char as pointer without a fixed size and also without dynamically allocating memory for it and that is not valid for all other types of data (int,...).
For Example:char *c; c="END"; c="BEGIN";
No errors
while int *d; d={1,2,3,4,5};
Gives an error
in fact to use d, an allocation of memory has to be done and then filling the array must to be through filling element by element while using c is so simple!!
AND ALSO, one an array of integers is initialized can't be modified except by accessing its element. But as in the above example string c is modified with no problem
So both should be considered the same in theory but actually they are not. I hope that you can help with explanation as
1)how the compiler deals with char *
2)and how memory is allocated to "END" then it is changed to "BEGIN", is that can overwrite used memory
Thank you in advance.