You can't assign values to an array dynamically - you can initialize an array when it's created, but once it's been set, you need to use other methods (such as a loop that sets each element or copy from somewhere with memcpy()).

I noticed that you're using '0' and '1' etc for the switch's case values. If x is storing a character (such as the return value of getchar()), that's what you want. But if x is storing an ordinary number, you want to use 0 and 1 etc for the case values.

"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell

You can't assign values to an array dynamically - you can initialize an array when it's created, but once it's been set, you need to use other methods (such as a loop that sets each element or copy from somewhere with memcpy()).

nendariani, this thread is dead, and your post adds nothing of importance to it.

Ask your question in a new thread. Oh, and while you are at it, post what you are trying to do, and how does it not work.

*thread closed*

EDIT:
Okay, I see that you actually stated how it does not work, but in the code itself. Nonetheless, ask it more clearly in a new thread... and did you actually write the code? It looks ancient with the old-style of parameter declaration.

I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.