COMP 280 Study Guide - Midterm Guide: C Dynamic Memory Allocation, Operand, Overflow Flag

62 views6 pages

Document Summary

Use printf to print out variables of various types (including pointers). Type char unsigned char unsigned char hexadecimal short int unsigned short int int unsigned int float long int unsigned long int double pointer. %lu x86-64 b b b w w l l s q q. %p (int * / &) %s (char *) q. The h modifies the d in %d to turn it into a short integer. Compare : malloc and calloc are both memory allocate functions that create array in terms of contiguous memory locations. Pointer arithmetic used to access various memory addresses: int . Binary hexadecimal: 1101 0001 1110 = 0xd1e. Hexadecimal decimal: 0x5a 10*16^0 + 5*16^1 = 9010. Negate a two"s complement number without converting it to any other representation. Convert an n-bit two"s complement number to an equivalent m-bit two"s complement number (where m > n). Arithmetic shift negative to the left) -- sa .