这边c程序哪里有问题???

[复制链接]
查看11 | 回复3 | 2010-11-12 23:04:30 | 显示全部楼层 |阅读模式
#include//有问题?????
#include
#define N 5
void main();
{
char *str[N]={"today","is","a","good","day"}

void sort(char**,int );
// system("pause");
sort(str,N);
}
void sort(char **str,int n)
{
int i,j;
char *temp=NULL;
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(strcmp(str,str[j])<0) //按字符串由大到小的顺序排列;
{

temp=str;

str=str[j];

str[j]=temp;
}
}
}
i=0;
while(i<n)
{
printf("%s\n",*str);
str++;
i++;
}
}

回复

使用道具 举报

千问 | 2010-11-12 23:04:30 | 显示全部楼层
void main ()后面没有分号 char *str[N]={"today","is","a","good","day"}后面少了分号
回复

使用道具 举报

千问 | 2010-11-12 23:04:30 | 显示全部楼层
没什么太大问题啊.char *str[N]={"today","is","a","good","day"}最后少个分号,void sort(char**,int );放到函数外面,比如main的上一行就可以了
回复

使用道具 举报

千问 | 2010-11-12 23:04:30 | 显示全部楼层
你是指第一行有问题么?是在用VC么?stdio.h文件VC里没有哦
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行