1.代码
// ConsoleApplication15.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
#include <iostream>
void funPointer(int a,int* b) {
int c = 5;
//b = &c;
*b = c;
}
void funReferenced(int a, int& b) {
int c = 6;
b = c;
}
int main()
{
int a = 1;
int b = 3;
funPointer(a, &b);
printf("b:%d\n",b);
funReferenced(a, b);
printf("b:%d\n", b);
std::cout << "Hello World!\n";
getchar();
}
2. 结果