Ge Wangcore ejectedd38351c9 years agoHistory
32 lines · 686 B · C++
RawDownload
// name: platform.cpp// desc: finds sizes// author: Ge Wang (gewang@cs.princeton.edu) #include <iostream>using namespace std; // unionunion X{    short s;    char  b[2];}; // entry pointint main( int argc, char ** argv ){    X x;    x.s = 0x0100;     // go    cout << "char: " << sizeof(char) << endl;    cout << "short: " << sizeof(short) << endl;    cout << "int: " << sizeof(int) << endl;    cout << "long: " << sizeof(long) << endl;    cout << "float: " << sizeof(float) << endl;    cout << "double: " << sizeof(double) << endl;    cout << "void *: " << sizeof(void *) << endl;    cout << "endian: " << ( x.b[1] ? "small" : "big" ) << endl;     return 0;}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t