In C/C++, variable of int can be defined and initiated using the form:
int i1 = 10;
int i2(20);
In Windows 8(Developer Preview), it's size id 4 byte.
Example:
![C/C++ Fundamental data type, int C/C++ Fundamental data type, int](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzdQGrehpoKpV2WZM7ltsXvxVRskv_vTIax69c_0U3dn9U07t91oxvdwub3r2XYzwvs3itwAOooNnQBLYT1vPlIo8KorTgbagPHKDPSVOHTO4kd46S8B9b9W1tXxEbtb1xQC2KzHV2Lyg/s400/int.png)
// ConsoleApplication1.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { int i1 = 10; int i2(20); cout << "size of i1(int): " << sizeof(i1) << endl; cout << "i1 = " << i1 << endl; cout << "size of i2(int): " << sizeof(i2) << endl; cout << "i2 = " << i2 << endl; system("PAUSE"); return 0; }
No comments:
Post a Comment