指向指针的指针, 现在很理解!

来源:互联网 发布:黑莓priv优化全攻略 编辑:程序博客网 时间:2024/06/01 08:28
#include <iostream>#include <cstdio>#include <cstdlib>using namespace std;int main() {    int a = 3;    int* x = &a;    int** k1 = &x;        cout << a << endl;    cout << *x << endl;    cout << **k1 << endl;    cout << x << endl;       cout << *k1 << endl;    cout << k1 << endl;    return 0;}// -----------------------
//  C 语言交换两个数字实现
#include <stdio.h>#include <string.h>#define BUG printf("here\n");'/void swap(int *a, int *b) {    int temp = *a;    *a = *b;    *b = temp;}int main() {    int x, y;    x = 3, y = 5;    swap(&x, &y);    printf("%d %d\n", x, y);    return 0;}


原创粉丝点击