#include <windows.h>
#include <tchar.h>
#define BYTES_TO_KB 1024
int main(void) {
MEMORYSTATUSEX statex;
statex.dwLength = sizeof(statex);
GlobalMemoryStatusEx(&statex);
_tprintf(TEXT("%I64d KB total virtual memory\n"), statex.ullTotalVirtual / BYTES_TO_KB);
_tprintf(TEXT("%.2f GB total virtual memory\n"), (statex.ullTotalVirtual / BYTES_TO_KB) / (1024.0 * 1024.0));
return 0;
}
/*
run:
2097024 KB total virtual memory
2.00 GB total virtual memory
*/