Tag: stack layout

Pitfall of C array

CODE int main() { int my_array[4] = {11,12,13,14}; int next = 15; printf(“\nSurprise = %d”, my_array[4]); } What should it print? Well, although illegal, the above code does legal things. The array “my_array” has four integers allocated on the stack. The next integer “next” is allocated adjacent to […]