C-Language Basics-Simple additions to data types

Source: Internet
Author: User

What to add:

Type descriptor: Long, long long, short, unsigned and signed

The type specifier is syntactically placed before the type of the declaring variable. For example, long int A is a variable A that declares a long integer.

1.long

The exact precision of a variable declared by long depends on the system, and on many systems the same range of values for type int and long int can be used to store integer values up to 32 bits wide (2 of 31 powers-1 or 2147483647). When declaring a long int type variable, you can add l after the integer constant, for example

long int numberofmax = 1122334455667L;

2.long Long

A long long declaration is a specified extension precision, which guarantees that the precision bit width is at least 64 bits, and the declared format is long long int numberofmax.

3.unsigned and signed

Apparently functionally opposite, unsigned is an unsigned, that is, not a negative number. unsigned int number This is number as a variable cannot be a negative number.

Type Common examples

printf characters

Char ' A ', ' \ n ' %c
_bool 0,1 %i,%u
Shrot int %hi,%hx,%ho
unsigned short int %hu,%hx,%ho
Int 12,-100,0177 (octal), 0xffe0 (hex) %i,%o,%x
Unsigend int 12u,100u,0xffu %u,%o,%x
Long int 12l,-100,0xfffl %li,%lx,%lo
unsigned long int 12ul,100ul,0xffeeul %lu,%lx,%lo
Long Long int 0xe5e5e5e5ll,505ll %lli,%llx,%llo
unsigned long long int 12ull,0xffeull %llu,%llx,%llo
Float 12.34f,3.1e-5f,0x1.5p10,0x1p-1 %f,%e,%g,%a
Double 1.23,3.1e-5,0x.1p3 %f,%e,%g,%a
Long double 12.341,3.1e-5l %lf,%le,%lg

C-Language Basics-Simple additions to data types

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.