这个博客写的很明白了。
现在就是不能完成C++的代码跳转,我还没学完C++,继续学习C++吧
看了一下这个视频,感觉讲的还行,就是老师的风格有点无聊,(老师自己也这么说)。
C++ 基础视频:http://edu.51cto.com//center/course/lesson/index?id=110557
今天学了C++的基本历史,编译器啥的,还有Qt的使用,应该以后都是在这个Qt上进行开发吧
有段指针的代码:
int a = 100;
int &b = a; // 引用
cout << "a : " << a << " &a : " << &a << endl;
cout << "b : " << b << " &b : " << &b << endl;
cout << endl;
b = 200; // 修改引用的值
cout << "a : " << a << " &a : " << &a << endl;
cout << "b : " << b << " &b : " << &b << endl;
cout << endl;
int *c = &a;
int *&d = c; // 指针的引用
cout << "a : " << a << " &a : " << &a << endl;
cout << "b : " << b << " &b : " << &b << endl;
cout << "c : " << c << " &c : " << &c << endl;
cout << "d : " << d << " &d : " << &d << endl;
cout << endl;
*c = 300; // 通过指针修改变量的值
cout << "a : " << a << " &a : " << &a << endl;
cout << "b : " << b << " &b : " << &b << endl;
cout << "c : " << c << " &c : " << &c << endl;
cout << "d : " << d << " &d : " << &d << endl;
cout << endl;
*d = 400; // 通过指针的引用修改变量的值
cout << "a : " << a << " &a : " << &a << endl;
cout << "b : " << b << " &b : " << &b << endl;
cout << "c : " << c << " &c : " << &c << endl;
cout << "d : " << d << " &d : " << &d << endl;
cout << endl;
return 0;
输出:
a : 100 &a : 0x7ffeee6709a8
b : 100 &b : 0x7ffeee6709a8
a : 200 &a : 0x7ffeee6709a8
b : 200 &b : 0x7ffeee6709a8
a : 200 &a : 0x7ffeee6709a8
b : 200 &b : 0x7ffeee6709a8
c : 0x7ffeee6709a8 &c : 0x7ffeee670998
d : 0x7ffeee6709a8 &d : 0x7ffeee670998
a : 300 &a : 0x7ffeee6709a8
b : 300 &b : 0x7ffeee6709a8
c : 0x7ffeee6709a8 &c : 0x7ffeee670998
d : 0x7ffeee6709a8 &d : 0x7ffeee670998
a : 400 &a : 0x7ffeee6709a8
b : 400 &b : 0x7ffeee6709a8
c : 0x7ffeee6709a8 &c : 0x7ffeee670998
d : 0x7ffeee6709a8 &d : 0x7ffeee670998
本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!