Bloomberg Interview Question

char s = "Hello"; .... If this statement is within a function and the pointer is returned .. will it print the string in the calling function; This led to a discussion as to where in the memory the string gets stored etc.

Interview Answer

Anonymous

Mar 10, 2010

I had said the right answer intially data part of data segment but he tried arguing that it is in heap. I got confused for stack but wasnt convinced it to be stored in the heap.