There is no such thing as a recoverable failure while allocating an array on the stack (first method). It will fail if the allocation leads to a stack overflow, after which your program is interrupted / terminated anyway.
When you allocate an array in the first way, it is allocated on the stack, usually when a function is called. If there is not enough space on the stack to allocate it, the program aborts with the / segfault error.
When you allocate the second method, you request a memory manager for memory on the heap during a malloc call.
EDIT: As @Deduplicator mentioned, if you are on a system without memory protection and you donโt have enough free space on the stack to allocate an array, this can lead to overflows and much more subtle problems (although most likely the instruction will be soon enough).
source share