warning C4047: 'function' : 'int *' differs in levels of indirection from 'int '
挺简单的问题我怎么老是搞不好,我都怀疑自己智商了//输入9(n)个数,用一函数使最后3(m)个数变成前面3(m)个数,前6(n-m)个数后移(要求用指针)
#include<stdio.h>
int main()
{
void sort(int a[8]);
int n[8],i;
printf("please input 9 numbers:\n");
for(i=0;i<9;i++)
scanf("%d",&n[i]);
printf("the result is:\n");
sort(n[8]);
return 0;
}
void sort(int a[8])
{int i;
int *p;
for(i=6,p=&a[6];i<9;i++,p++)
printf("%d",*p);
for(i=0,p=&a[0];i<6;i++,p++)
printf("%d",*p);
}
警告:
warning C4047: 'function' : 'int *' differs in levels of indirection from 'int '
warning C4024: 'sort' : different types for formal and actual parameter 1