Other integer types
When you beginner C, the int type will satisfy most of your needs for integers.
The C language also provides three keywords to modify basic integer types: short, long, and unsigned. Here are a few points to note:
(1) The C language does not specify the number of bytes of memory for each type of data, only the long data is longer than or equal to the int type, short data is shorter than or equal to the long type. Thus the short int type may occupy less storage space than the int type. Space-saving applications where small values are required. Like the int type, the short type is a signed type .
(2) The long int type may occupy more storage space than the int type. is also a signed type.
(3) The unsigned int type is used for applications where only non-negative values are used. This type differs from the representation range of a signed type. For example, a 16-bit unsigned int has a range of 0 to 65535, while an int has a range of 32768 to 32767. So when choosing an integer type, consider the unsigned type first if you don't need a negative number. Unsigned types can achieve a larger positive number than the signed type, and can enhance readability.
Output unsigned int numbers can use the%u notation, the output long value can use the%ld specifier, and the symbol%HD can be used to output the short int type.
Let's see an example:
#include <stdio.h> int main (void) {//declares a variable of type long int, the variable is named Money, and initializes it, and then outputs the variable//write down your code here long int money = 1; printf ("%ld", money); return 0; }
more learning content, just in the code bud Net Http://www.mayacoder.com/lesson/index
Basic data types for C language Basics-Other integer types