A char
is 1 byte, a char*
is, most likely, 4 bytes (can be more, can be less).
So the first case attempts to allocate more memory (~4 times more) an the stack. Stack memory is limited, it just happens that 1000000
bytes fit on your platform on the stack, but 4 * 1000000
don't.