大佬们好,我是c语言的初学者,请问为什么这个程序语法没错运行时里面有个函数task6没有被执行

#include
#include
#define N 30
void Input(int n,int *p1, char *p3[N], char *p2[N]);
void Average(int n,int *p1);
void Task6(int n,int *p1, char *p3[N], char *p2[N]);
int main()
{
int n, sorce[N];
int *p1=sorce;
printf("how many students?\n");
scanf("%d",&n);
char number[n][N];
char name[n][N];
char *p2[N];
char *p3[N];
int i = 0;
for(;i<n;i++)
{
p2[i]=name[i];
p3[i]=number[i];
}
Input(n,p1,p3,p2);
Average(n,p1);
Task6(n,p1,p3,p2);
}

void Input(int n,int *p1, char *p3[N], char *p2[N])
{
int i=0;
for(;i<n;i++)
{
printf("No.%d students name: \n",i+1);
getchar();
gets(*p2+i);
printf("the students number: \n");
gets(*p3+i);
printf("thr students sorce: \n");
scanf("%d",(p1+i));

}

}

void Average(int n,int p1)
{
int i=0,sum=0;
for(;i<n;i++)
{
sum+=
(p1+i);
}
printf("the sum is %d\n",sum);
printf("the average is %d\n",sum/n);
}

void Task6(int n,int *p1, char *p3[N], char *p2[N])
{
int temp1;
char *temp2;
char *temp3;
int i =0,j;
for(;i {
for(j=i+1;j {
if(p1[i]>p1[j])
{
temp1 = p1[i];
p1[i] = p1[j];
p1[j] = temp1;
temp2 = p2[i];
p2[i] = p2[j];
p2[j] = temp2;
temp3 = p3[i];
p3[i] = p3[j];
p3[j] = temp3;

        }

    }
 }
 for(;i<n;i++)
 {
    printf("%6d%13s%13s\n",p1[i],p2[i],p3[i]);
 }

}

1个回答

检查一下逻辑是否没链接上

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐