TSORT..why run time error..??

i declared array[1000000] inside main…it gave runtime error but when declared gobally it worked…why so…??

variable inside main gets allocated to stack and variables declared outside main i.e global are allocated to heap…

Most of the online platforms allow only limited amount of stack size to the programs submitted
.Memory allocation in different is beautifully explained in this link below have a look

1 Like