main() {
char names [5][20] = {
"rmaesh",
"ram",
"suresh",
"sam"
"ramu"
};
char *t;
t = names[2];
names[2] = names[3];
names[3] = t;
printf(" the array elemsnt are \n");
int i = 0;
for (i = 0; i < 5; i ++)
printf("\n%s", names[i]);
}
我在编译这个程序时遇到错误
stringarrary.c: In function ‘main’:
stringarrary.c:12:11: error: incompatible types when assigning to type ‘char[20]’ from type ‘char *’
names[2] = names[3];
^
stringarrary.c:13:11: error: incompatible types when assigning to type ‘char[20]’ from type ‘char *’
names[3] = t;