指针方面很菜,求大佬看看。
用指向指针的指针的方法对5个字符串进行排序。#include<stdio.h>
#include<string.h>
int main()
{
char *s[5],**p;
int i,j,
printf("输入5个字符串:\n");
for(i=0;i<5;i++)
{
scanf("%s",s[i]);
p=s+i;
}
for(i=0;i<5;i++)
{
for(j=0;j<5-i;j++)
{
if(strcmp(*(p+i),*(p+i+1))>0)
strcpy(*(p+i),*(p+i+1));
}
}
for(i=0;i<5;i++)
printf("%s,",*(p+i));
return 0;
}
错误
Compiling...
Cpp1.cpp
D:\C语言\Cpp1.cpp(7) : error C2440: 'initializing' : cannot convert from 'char [16]' to 'int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
D:\C语言\Cpp1.cpp(22) : error C2064: term does not evaluate to a function
Error executing cl.exe.
Cpp1.obj - 2 error(s), 0 warning(s)
这要怎么改啊???