Again, your errors are in lines 29, 30 and 31... Ohk, I guess you're not understanding the concept of same data/variable type..
name is an array of array of characters, or an array of strings.
name[i] holds an array of characters (a string)
name[i][j] holds a single character, to be precise, the (j+1)
th letter of the (i+1)
th name. For example:
name[3][4] would show the 5th letter of the 4th name in the array.
Now hold is a single character. You cannot copy a string (an array of chars) into a single char, can you! You need another string.. So declare hold as a string, as so:
Furthermore, as you're dealing with the string library, you should know about the string copy function, strcpy. It works as so: strcpy(s1, s2) copies string s2 into s1. So lines 29, 30, and 31 can be replaced with:
1 2 3
|
strcpy(hold, name[i]);
strcpy(name[i], name[i+1]);
strcpy(name[i+1], hold);
| |
Does that make it clearer now?