[求助]初学,指针问题,谢谢指点
以下这段,可以运行,但是有"NULL pointer assignment"的警告,是什么原因,该如何修改,忘清楚告知,谢谢了!!!!!!!!
#include <stdio.h>
int swap(int *p1,int *p2);
int main()
{
int *pointer_1,*pointer_2,*pointer_3;
scanf("%d,%d,%d",pointer_1,pointer_2,pointer_3);
if(*pointer_1>*pointer_2)
{
swap(pointer_1,pointer_2);
}
if(*pointer_1>*pointer_3)
{
swap(pointer_1,pointer_3);
}
if(*pointer_2>*pointer_3)
{
swap(pointer_2,pointer_3);
}
printf("%d,%d,%d\n",*pointer_1,*pointer_2,*pointer_3);
return 1;
}
int swap(int *p1,int *p2)
{
int temp;
temp=*p1;
*p1=*p2;
*p2=temp;
return 1;
}