VC常用資料類型

來源:互聯網
上載者:User

VC常用資料類型(2006.11.26):

類型              位元組數 位元   範圍        備忘意:
char               1      8    -128-127
signed char        1      8    -128-127
unsigned char      1      8     0-255
short int          2      16   -32768-32767
signed short int   2      16   -32768-32767
unsigned short int 2      16   0-65535
int                4      32   -2147483648-2147483647
signed int         4      32   -2147483648-2147483647
unsigned int       4      32   0-4294967259
long int           4      32   -2147483648-2147483647
signed long int    4      32   -2147483648-2147483647
unsigned long int  4      32   0-4294967259
long            4         32  -2,147,483,648 to 2,147,483,647
float           4         32              3.4E +/- 38 (7 digits)
double          8         64              1.7E +/- 308 (15 digits)
long double     10        80               1.2E +/- 4932 (19 digits)
以下為windef.h中有關VC常用資料類型的定義:

typedef unsigned long       DWORD;
typedef int                 BOOL;
typedef unsigned char       BYTE;
typedef unsigned short      WORD;
typedef float               FLOAT;
typedef FLOAT               *PFLOAT;
typedef BOOL near           *PBOOL;
typedef BOOL far            *LPBOOL;
typedef BYTE near           *PBYTE;
typedef BYTE far            *LPBYTE;
typedef int near            *PINT;
typedef int far             *LPINT;
typedef WORD near           *PWORD;
typedef WORD far            *LPWORD;
typedef long far            *LPLONG;
typedef DWORD near          *PDWORD;
typedef DWORD far           *LPDWORD;
typedef void far            *LPVOID;
typedef CONST void far      *LPCVOID;
typedef int                 INT;
typedef unsigned int        UINT;
typedef unsigned int        *PUINT;
typedef WORD                ATOM;
1.使用sizeof( )可以得到任何對象佔用的位元組數,例如如果有一個char類型的變數a, 則sizeof(a)會返1.
2.還可以藉助typedef定義自己的資料類型,例如typedef myint unsigned int;後myint就等價於unsigned int.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.