Please see this to format your code so we can read it (it's very hard to follow as it is) and also this about main() .
What is the value of sizeof names[i][j] ? Are you sure this is what you want?
It really helps to print the value of important variables as the program runs to make sure they are the values you expect.
1) If they aren't what you expect, figure out why.
2) If you don't know what to expect, sign up for shop :icon_mrgreen:
WaltP
Posting Sage w/ dash of thyme
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944