c语言__第四讲指针练习
c语言__第四讲指针练习例1 通过指针变量访问整型变量#include int main(){ int a=100,b=10; int *pointer_1, *pointer_2; pointer_1=&a; pointer_2=&b; printf("a=%d,b=%d\n",a,b); printf("*pointer_1=%d,*pointer_2=%d\n",*pointer_1,*pointer_2); return 0;}----------------------------------------------------------------------------例2 输入a和b两个整数,按先大后小的顺序输出a和b。#include int main(){ int *p1,*p2,*p,a,b; printf("integer numbers:"); scanf("%d,%d",&a,&b); p1=&a; p2=&b; if(aint main(){void swap(int *p1,int *p2); int a,b; int*pointer_1,*pointer_2; printf("please enter a and b:"); scanf("%d,%d",&a,&b); pointer_1=&a; pointer_2=&b; if (aint main(){ void exchange(int *q1, int *q2, int *q3); int a,b,c,*p1,*p2,*p3; scanf("%d,%d,%d",&a,&b,&c); p1=&a;p2=&b;p3=&c; exchange(p1,p2,p3); printf("%d,%d,%d\n",a,b,c); return 0;}void exchange(int *q1, int *q2, int *q3) { void swap(int *pt1, int *pt2); if(*q1int main(){ int a[10]; int i; printf("enter 10 integer numbers:\n"); for(i=0;i<10;i++) scanf("%d",&a[i]); for(i=0;i<10;i++) pri