出现error C2100: illegal indirection应该怎么解决???
#include <stdio.h>void inarr(int *p,int n);
void ouarr(int *p,int n);
int sum(int *p,int n);
void sort(int *p,int n);
void main()
{
int a,n[50],*p;
p=n;
printf("请输入10个数\n");
inarr(p,10);
a=sum(p,10);
printf("这10个数的平均值是%d\n这10个数的和是%d\n",a/10,a);
sort(p,10);
printf("从小到大的排序为");
ouarr(p,10);
}
void inarr( int *p,int n)
{
int i=0;
for(i;i<n;i++)
{scanf("%d",*p[i]);}
}
void ouarr(int *p,int n)
{
int i=0;
for(i;i<n;i++)
{printf("%d",*p[i]);}
}
int sum(int *p, int n)
{
int i,sum=0;
for(i=0;i<n;i++)
{sum+=p[i];}
return(sum);
}
void sort(int *p,int n)
{
int i=0,j,t;
for(i;i<n;i++)
{scanf("%d",*p[i]);}
for(i;i<n;i++)
for(j=i+1;j<n+1;j++)
if(*p[i]>*p[j])
{t=*p[i];
*p[i]=*p[j];
*p[j]=t;}
for(i;i<n;i++)
{printf("%d ",*p[i]);}
}下面是调试的结果
F:\c++工程\指针1\1.c(23) : error C2100: illegal indirection
F:\c++工程\指针1\1.c(29) : error C2100: illegal indirection
F:\c++工程\指针1\1.c(42) : error C2100: illegal indirection
F:\c++工程\指针1\1.c(45) : error C2100: illegal indirection
F:\c++工程\指针1\1.c(45) : error C2100: illegal indirection
F:\c++工程\指针1\1.c(46) : error C2100: illegal indirection
F:\c++工程\指针1\1.c(47) : error C2100: illegal indirection
F:\c++工程\指针1\1.c(47) : error C2100: illegal indirection
F:\c++工程\指针1\1.c(48) : error C2100: illegal indirection
F:\c++工程\指针1\1.c(50) : error C2100: illegal indirection
执行 cl.exe 时出错.
搜索更多相关的解决方案:
illegal indirection
----------------解决方案--------------------------------------------------------
看书....
----------------解决方案--------------------------------------------------------