C语言中的错误如何解决?error C2065: ✀P1✀ : undeclared identifier error C2100: illegal indirection

2024-12-03 16:13:48
推荐回答(3个)
回答1:

input two numbers:a,b34,66
max=66,min=34Press any key to continue

#include
#include

void main()
{
void swap(int *p1,int *p2);
int * pointer_1,* pointer_2;
int a,b;
printf("input two numbers:a,b");
scanf("%d,%d",&a,&b);
pointer_1=&a;pointer_2=&b;
if(a swap(pointer_1,pointer_2);
printf("max=%d,min=%d",a,b);
}
void swap(int *p1, int *p2)
{int temp;
temp=*p1; //手误 p大小写
*p1=*p2;
*p2=temp;

}

回答2:

temp=*P1;

改为小写小行了:
temp=*p1;

回答3:

temp=*P1 的P1改正小写的p1