Basic Data Type

Source: Internet
Author: User

Integer: the representation of integer data: decimal, octal, and hexadecimal integer data has the following reserved words: int, short, long, signed, unsigned integer data including signed) unsigned integer values of two types of integer data types: short: 2 bytes INT: 2 or 4 bytes (determined by the compiler, is a 16-bit compiler with 2 bytes and a 32-bit compiler with 4 bytes) LONG: 4 bytes unsigned and signed reserved words are applicable to the combination of the above three reserved words, it is used to determine whether an integer variable is a signed integer variable. At the same time, signed reserved words can be omitted.
  Signed Unsigned
Short -32768 ~ 32767 0 ~ 65535
Int -32768 ~ 32767-2147483648 ~ 2147483647 0 ~ 655350 ~ 4294967295
Long -2147483648 ~ 2147483647 0 ~ 4294967295
Output representation of Integer constants: For details, refer to the printf function.
Decimal Octal Hexadecimal
  Start with 0 Starting with 0x and 0x
    L, l end
% D % O (vomit) % X lowercase letters output % x uppercase letters output
  % # O: Output prefix 0 % # X output prefix 0x % # x output prefix 0x
% UD unsigned count % UO % Ul
We declare an integer constant. during compilation, the C compiler will automatically allocate it to one of short, Int, and long according to the constant size. Float: float: indicates a single float type in four bytes. The value range is 3.4 * 10-38e ~ 3.4*10 + 38 edouble: Double Floating Point type, expressed in 8 bytes, range: 1.7 * 10-308e ~ 1.7*10 + 308e floating point numbers are signed and do not have any unsigned floating point numbers. The floating-point constant is only in decimal format. All floating-point constants are double type by default. If the floating-point number is smaller than 1, the first 0 can be omitted. It can be divided into signed and unsigned char (-128 ~ 127), unsigned char (0 ~ 255); occupies a byte here, we need to mainly different compilers for the char type of data into integer processing difference, for Chinese characters, we need to define as unsigned char type. When defining a string array, char STR [N] can actually store n-1 valid characters. The Compiler automatically adds the "/0" null character. Character constant: it can contain single quotes or ASCII values. For characters that cannot be expressed by keyboard symbols, it is expressed by '/' or '/ASCII code value. For more information, see related documents. Double quotation marks ("") are used to enclose character array constants, also called string constants. Pointer type: used to store declared variable addresses. Different types of variables can be integer, floating point, structured, and combined pointers. Valueless: The Void byte length is used to explicitly indicate that a function does not return any value. Second, a pointer of the same type is generated.

 

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.