| 운영체제 | 모델 | char | short | int | long | 포인터 |
| Windows | LLP64 | 1바이트 | 2바이트 | 4바이트 | 4바이트 | 8바이트 |
| UNIX | LP64 | 1바이트 | 2바이트 | 4바이트 | 8바이트 | 8바이트 |
| #include <stdio.h> int main() { int arr[10] = {0, }; int arrVal = (int)arr; printf("pointer : %d \n", arrVal); return 0; } |
| WINDOWS 자료형 | 의미 | 정의 형태 |
| BOOL | Boolean variable | typedef bool BOOL |
| DWORD | 32-bit unsigned integer | typedef unsigned long DWORD; |
| INT | 32-bit signed integer | typedef int INT |
| LONG | 32-bit signed integer | typedef long LONG |
| UINT | Unsigned INT | typedef unsigned int UINT |
| ULONG | Unsigned LONG | typedef unsigned long ULONG |
| WINDOWS 자료형 | 의미 | 정의 형태 |
| PINT | INT에 대한 포인터 | typedef int* PINT |
| PLONG | LONG에 대한 포인터 | typedef LONG* PLONG |
| PUINT | UINT에 대한 포인터 | typedef unsigned int* PUINT |
| PULONG | ULONG에 대한 포인터 | typedef ULONG* PULONG |
| #if defined(_WIN64) typedef __int64 LONG_PTR; typedef unsigned __int64 ULONG_PTR; typedef __int 64 INT_PTR; typedef unsigned __int64 UINT_PTR; #else typedef long LONG_PTR; typedef unsigned long ULONG_PTR; typedef int INT_PTR; typedef unsigned int UINT_PTR; #endif |
| #include <stdio.h> #include <tchar.h> #include <windows.h> UINT_PTR CalDistance(UINT_PTR a, UINT_PTR b) { return a-b; } int _tmain() { INT32 val1 = 10; INT32 val2 = 20; _tprintf ( _T("distance : %d \n"), CalDistance((UINT_PTR)&val1, (UINT_PTR)&val2) ); return 0; } |