The simplest way to check this is to put the statements
printf("%d\n", sizeof(int));
printf("%d\n", sizeof(long int));
in a program. This will print the number of bytes used to store two
sorts of integers. If the first statement prints 4, you are all set.
If it prints 2 and the second statement prints 4, then the simplest
solution is to use the type long int in all of those
declarations where you would ordinarily use int and you are
concerned that the values may exceed, say, 16000. In addition, you
will use the conversion character "%ld" where you would
ordinarily use "%d" in printf and scanf
statements involving those variables. Finally, to designate a
constant as long, use the suffix L, for example, 1000000L.
Note that you need to do this with literal constants and #define
constants that are to be printed with a %ld placeholder, or they
won't print correctly. E.g.
Wrong Right
----- -----
#define TWO 2 #define TWO 2L
printf("%ld%ld", TWO, 3); printf("%ld%ld", TWO, 3L);
You can also try to change the compiler settings to always use 4-byte integers as the default. (You may have to do this if both statements print 2.) If you are using a PC, see the user's manual that came with your C compiler.