|
 
- 帖子
- 438
- 积分
- 870
- 金钱
- 3032 金币
- 贡献
- 0 点
- 包子
- 0 个
|
vc++ 请教
查找最大字符串数组,编译连接没有错,为何最后的cout没有输出?
#include <iostream.h>
#include <string.h>
#include <stdio.h>
char *max (char *p[],int n) //定义查找字符串数组中最大字符串函数
{
for(int i = 0;i < n;i++)
if(strcmp(p[0],p)<0) //假定p[0]最大,查找最大值
strcpy(p[0],p);
return p[0];
}
void main()
{
char *c[3]={"ao","ss","da"};
cout<<c[0]<<endl;
cout<<c[1]<<endl;
cout<<c[2]<<endl;
cout<<max(c,3)<<endl;
} |
|