指针

- (void)viewDidLoad {
    [super viewDidLoad];
    int a =5;
    int b =9;
    printf("\n%d %d",a,b);
    tempp(&a, &b);
    printf("\n%d %d",a,b);
}
void temp(int a,int b){
    printf("\n%d %d",a,b);
    int c;
    c=a;
    a=b;
    b=c;
    printf("\n%d %d",a,b);
}
void tempp(int * a,int * b){
    int  c;
    printf("\n%d %d",*a,*b);
    c=*a;
    *a=*b;
    *b=c;
    printf("\n%d %d",*a,*b);

}

posted @ 2016-01-26 15:51  谢小锋  阅读(110)  评论(0)    收藏  举报