pointerparam.cpp.svn-base

来自「QT方面的开发」· SVN-BASE 代码 · 共 22 行

SVN-BASE
22
字号
#include <iostream>using namespace std;void messAround(int* ptr) {    *ptr = 34;  /* Change the value that is pointed to. */    ptr = 0;    /* Change the address stored by ptr. */}int main() {    int n(12);       /* Initialize an int. */    int* pn(&n);     /* Initialize a pointer that points to n. */    cout << "n = " << n << "\tpn = " << pn << endl;    messAround(pn);  /* See what is changed by messAround(). */    cout << "n = " << n << "\tpn = " << pn << endl;    return 0;}/*outn = 12  pn = 0xbffff524n = 34  pn = 0xbffff524*/

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?