logo
Course thumb

The C programming language made simple

Integer type conversions

#include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char* argv[]) { short int x = -16384; // 2 bytes - 2^14 int y = 1073741824; // 4 bytes - 2^30 // 01000000 00000000 00000000 00000000 x = y; // y % 65536 // 00000000 00000000 printf("%hd %d", x, y); return 0; }