65,210
社区成员
发帖
与我相关
我的任务
分享
问题1:
int Vac=3;
int main()
{
int Vac=10;
::Vac++;
cout < <::Vac < <endl;
cout < <Vac < <endl;
return 0;
}
看样子好像::表示全局作用域什么的,请问具体是什么?
--------------------------------------------
全局作用域描述符
---------------------------------------------
问题2:
int k=i+++j;
请问i+++j的运算顺序是什么?为什么?
------------------------------------
i+j
i=i+1
------------------------------
问题3:
32位机和64位机下数据类型的长度区别?
现在一般都是64位的吗?或者默认就是指64位环境下?
---------------------------------------------
对int等数据类型的浮动~
---------------------------------------------
问题4:
异或的运算
用异或实现两个数的交换时会用到a^b^a,表达式结果为b,运算过程看的懂,但是不清楚为什么能这样?
谁能说说其原理,谢谢
---------------------------------------------
0^1^0=1 0^0^0=0 1^0^1=1 1^1^1=1
--------------------------------------------
问题5:
为什么分配内存时,是从高地址向低地址分配?(按照正常思维,应该是低到高)
比如int i=1; float f=1.23;
i的地址比f的地址要大
-------------------------------
栈的存储
push pop
------低地址
local变量(int i先定义,就先入栈了)
ebp
return返回地址
参数1
.
.
.
参数n-1
参数n
---------高地址
---------------------------------
Example
This example has two variables named amount. The first is global and contains the value 123. The second is local to the main function. The scope resolution operator tells the compiler to use the global amount instead of the local one.
// expre_ScopeResolutionOperator.cpp
// compile with: /EHsc
// Demonstrate scope resolution operator
#include <iostream>
using namespace std;
int amount = 123; // A global variable
int main() {
int amount = 456; // A local variable
cout << ::amount << endl // Print the global variable
<< amount << endl; // Print the local variable
}