Quote Originally Posted by rothj0hn
Code:
char num[4];
scanf("%s",num[4]);
This does not do what you think it does. It should cause a segmentation fault.
You're telling scanf() that you want to put a string at the address stored in num[4], which is beyond the end of the array num[], and is also a char, not a pointer.

I'll leave it to others to explain why making num[] only 4 elements long is a bad idea.