You do not have such a large stack space to allocate an array that is large ... on Linux, for example, the stack size is usually 8192 bytes. You definitely exceeded that.
The best option would be to allocate memory on the heap using malloc(). Therefore you must write char* large = malloc(S);. You can access the array using notation [].
, Linux, sudo ulimit -s X, X - , , ... .