程序清单:
编译运行源程序:
longmenyu@longmenyu-Vostro-1088:~/test/code/cpp$ ./pointer_test
The value of p1 points:I'm string 1
The value of p2 points:I'm string 2
Now the value of p1 points:I'm string 3
Now the value of p1 points:I'm string 2
The value of pi1 points:1024
The value of pi2 points:2048
Now the value of pi1 points:2048
The value of ri1:1024
The value of ri2:2048
Now The value of ri1:2048
The value of ri1 is equal to the value of ri2
本文通过一个C++程序示例展示了指针与引用的基本用法,包括如何声明、初始化及修改指针和引用所指向的数据。此外,还演示了指针赋值与引用赋值的区别,以及它们在实际应用中的行为差异。
1214

被折叠的 条评论
为什么被折叠?



