这个C程序的运行结果是什么,帮忙计算下,我的电脑软件出拉故障~~马上要交作业拉,急啊!!!

来源:百度知道 编辑:UC知道 时间:2024/06/14 04:05:42
#include<stdio.h>
#defineN 5
fun(char*8,char 8,int n)
{int j;
*s=a;j=n;
while(*s<s[j]) j--;
return j;
}
main()
{char c[N+1];
int i;
for(i=1; i<=N;i++) *(c+1)=’A’+1+1;
printf(”%d\n”,fun(c,’E’,N));

5

你的程序拷贝时没注意,有很多地方错了。我修改了一下,运行过了。

有错误

好多错误,改了一下:
#include<stdio.h>
#define N 5
int fun(char *s, char a, int n)
{
int j;
*s = a;
j = n;
while(*s < s[j])
j--;
return j;
}
void main()
{
char c[N+1];
int i;
for(i=1; i<=N; i++)
*(c+1) ='A' + 1 + 1;
printf("%d\n", fun(c, 'E', N));
}

结果是:
5
Press any key to continue