3C科技 娛樂遊戲 美食旅遊 時尚美妝 親子育兒 生活休閒 金融理財 健康運動 寰宇綜合

Zi 字媒體

2017-07-25T20:27:27+00:00
加入好友
[C/C++ 基礎]-證明所有指標變數大小一至且計算編譯器所編譯成是的定指空間大小   剛才寫的一個可以證明所有指標變數大小一至且計算編譯器所編譯成是的定指空間大小的範例,歡迎有興趣C/P同好,一起來C/P一下。     #include <iostream> #include <cmath> using namespace std; int main() { char *chr_pA; int *int_pB; double *dbl_pC; int intD=0; intD=sizeof(chr_pA); cout << "char point size=" << intD << endl; intD=sizeof(int_pB); cout << "int point size=" << intD << endl; intD=sizeof(dbl_pC); cout << "double point size=" << intD <<endl; cout << "The C++ compiler is " << (8*intD) << " Bits"<<endl; cout << "The APP can use max of main memory size that is " <<pow((float)2,(float)(8*intD)) << " Bytes" <<endl; return 0; }線上執行結果網址:http://codepad.org/WAkwq3OD    

本文由jashliaoeuwordpress提供 原文連結

寫了 5860316篇文章,獲得 23313次喜歡
精彩推薦