C++ 指针学习菜鸟,求各位大神解惑(代码见下)
#include"iostream"usingnamespacestd;intmain(){intmyAge;int*pAge=nullptr;myAge=5;pAge=...
#include "iostream"
using namespace std;
int main()
{
int myAge;
int *pAge=nullptr;
myAge=5;
pAge=&myAge;//这两个地方为什么不一样???
cout<<"myAge:"<<myAge<<"\t";
cout<<"*pAge:"<< *pAge<<"\t";
return 0;
}
#include <iostream>
int main()
{
int myAge=5;
int *pAge =&myAge; // 这两个地方为什么不一样???
std::cout << "myAge: " << myAge << "\n";
std::cout << "*pAge: " << *pAge << "\n\n";
return 0;
} 展开
using namespace std;
int main()
{
int myAge;
int *pAge=nullptr;
myAge=5;
pAge=&myAge;//这两个地方为什么不一样???
cout<<"myAge:"<<myAge<<"\t";
cout<<"*pAge:"<< *pAge<<"\t";
return 0;
}
#include <iostream>
int main()
{
int myAge=5;
int *pAge =&myAge; // 这两个地方为什么不一样???
std::cout << "myAge: " << myAge << "\n";
std::cout << "*pAge: " << *pAge << "\n\n";
return 0;
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询