Yeah - he is never going to work.You can not do that with arrays - they are assigned memory statically - there is no such thing as a dynamic one (well not in C anyway).So what your code is doing is basically trying to write over memory that does not belong to it.