bobobread 发表于 2017-5-8 12:10:35

用指针将三个数由小到大输出出现 lvalue required as left operand of assignment

如题,最后一行出现 lvalue required as left operand of assignment是为什么还请各位大神指教{:10_254:} {:10_254:}
#include<stdio.h>
int main(){
        void swap(int *x,int n );
        int *p,a,i;
                printf("请输入3个数;\n");
        for(i=0;i<=2;i++)
        {
        scanf("%d",&a);
        }
        p=a;
        swap(p,3);
        printf("排序以后;\n");
        for(i=0,i<=2;i++;)
        printf("%d",&p+i);
        return 0;
}
void swap(int *x,int n){
        intj,k;
        for(k=1;k<=n,k++;)
    if(*x>*x+1);
    j=*x;*x=*x+1;*x+1=j;
}

人造人 发表于 2017-5-8 12:29:03

把代码写好

你这么写能对吗?

bobobread 发表于 2017-5-8 17:35:25

人造人 发表于 2017-5-8 12:29
把代码写好

你这么写能对吗?

谢谢指教。。已经发现错误了{:10_282:}
页: [1]
查看完整版本: 用指针将三个数由小到大输出出现 lvalue required as left operand of assignment