引用与指针的比较

引用与指针的比较

引用是 C++中的概念,初学者容易把引用和指针混淆一起。一下程序中,n 是 m 的一 个引用(reference),m 是被引用物(referent)。

 1 #include <iostream>
 2 
 3 /* run this program using the console pauser or add your own getch, system("pause") or input loop */
 4 using namespace std;
 5 int main(int argc, char** argv) {
 6     
 7     //计算和打印打印乘法九九表
 8     for (int i=1;i<=9;i++) {
 9         cout<<i;
10         for (int j=1;j<=9;j++)
11             cout<<'	'<<i<<"*"<<j<<"="<<i*j;
12         cout<<endl;
13     }
14     return 0;
15 }
原文地址:https://www.cnblogs.com/borter/p/9406380.html