Is it possible to allocate an array on heap even if it is scoped inside a function? Here is my C program:
void SimpleTextEditor()
{
char textEditor[1000000];
char operationText[1000002];
//do something with the arrays
}
This results in stackOverflow exception for obvious reason that I'm trying to allocate two big sized arrays. If I move any one of the arrays outside the function and make it global (file level variable) then it works as global variables are allocated on heap.
But I don't want to make my variables global. Is it not possible to allocate the memory dynamically for arrays using malloc and calloc?