this is not a Code::Blocks question - your post will probably be locked.
However, here is an answer for you: if you are allocating an array inside a function (inside {}), then memory on the Stack will be allocated (the Stack is a temporary memory allocated at function call, and freed at function exit).
The Stack has a limited capacity (it depends on the OS). So when you are allocating a very big array, you are using more memory than the Stack can handle.
And every Stack error leads to a program crash.
For the same reason, recursive functions are a very bad idea.
I suggest you to find a good book and / or web site for learning the programmation, this one for example:
http://www.cppreference.com/wiki/startregards,
Sebastien