Using format specifiers for unsigned integers
Unsigned integers include positive integers in several base numbering systems, as well as pointer values. The first example program is unsignedInt.c
, and it begins as follows:
#include <stdio.h>
int main( void ) {
int smallInt = 12;
int largeInt = (1024*1024*3)+(1024*2)+512+128+64+32+16+8+4+2+1;
int negativeInt = -smallInt;
unsigned anUnsigned = 130;
// the other code snippets go here.
}
This code defines smallInt
, largeInt
, negativeInt
, and unsigned int
values. These will be used in each snippet that follows. After you type in the program and get it to run, you may want to experiment with different values for each of these variables.
Using unsigned integers in different bases
In the first code snippet, values in various base numbering systems are printed—these...