// file: lecture_09/example.cc // // local include files // #include "example.h" // method: main // // main program starts here // int main(int argc, char** argv) { // grab the command line value as a short int // unsigned short val = atoi(argv[1]); unsigned char* b = (unsigned char*)&val; // display the byte values // fprintf(stdout, "val = %d, [b1 b0] = [%d %d]\n", val, b[1], b[0]); // convert to an unsigned char // unsigned char c = val; fprintf(stdout, "c = %d\n", c); // exit gracefully // exit(0); }