First one results in [undefined behaviour][1]. For not having [UB][2] you need to allocate memory using either `malloc` or `calloc`. Allocating memory will store the data in heap. After you done with your task , you need to `free` the allocated memory also. Second one do not result in [UB][3]. it stores the array data in stack and not on heap. Memory is automatically freed from stack once the scope is over. [1]: http://theunixshell.blogspot.com/2013/07/what-is-undefined-behavior.html [2]: http://theunixshell.blogspot.com/2013/07/what-is-undefined-behavior.html [3]: http://theunixshell.blogspot.com/2013/07/what-is-undefined-behavior.html