Am looking at the following program and not sure how the memory is allocated and why:
void function() { char text1[] = \"SomeText\"; char* text2 = \"Some
Yes you are right, on most systems:
text1 will be a writable variable array on stack (it is required to be a writable array)
text1
text2 has to be const char* actually, and yes, it will point to a text segment of the executable (but that might change across executable formats)
text2
const char*
text will be on heap
text