C-Language Basics-data types

Source: Internet
Author: User

I. Integer type: int

1. Introduction

In c, an integer constant consists of a sequence of one or more digits, and contains a positive or negative sign before the digit (plus, of course, can be omitted), there can be no space comma between the digits, and so on. Example: 12000,-190 is an int type, but 12,000 is not a valid int type.

2. Binary

I. Decimal: Commonly used in daily life of the system. The cardinality is 10, indicating to decimal, each digit number above the valid number is 0~9 (first bit not 0, for rigorous expression).

II. Eight binary: used in the computer. The cardinality is 8, indicating to octal that the valid number of each bit is 0~7. Usually if the first digit of the integer value is 0, then we think he is octal. Example: Octal 050 is represented as 40 (decimal).

Iii. 16 binary: An integer value the first bit with 0x we think of him as Hex. The base is 16, which indicates to 16, each single digit above the valid value is 0~9, the difference is 10~15 we use the abcdef to correspond to the expression. Example: 0xAAFFDD.

Two. Floating-point numeric type: float

1. Introduction

Data declared as floating-point in the C language is used to store numeric values that contain decimal digits. The identity of a floating-point value constant is a decimal number that can be omitted before the decimal point, or the number of digits after the decimal point can be omitted. For example: 3. Is allowed,-.002 is also allowed. Need to introduce is the scientific notation, this one sentence took: E is followed by a power of 10. For example 12000 is expressed in scientific notation for 1.2e4. The power of the 10 followed by this e can be negative.

Three. Extended Precision Type: double

1. Introduction

Similar to float, when float indicates that the range is insufficient, a double can be used instead.

Four. Single character type: Char

1. Introduction

Char is used in the C language to store a single character and is enclosed in single quotation marks. Example: ' A ', ', ', ' \ n ' are all possible \ nthe newline character, although it is two characters, but as a whole.

Five. Boolean data type: _bool

1. Introduction

Only two values stored by the _bool data type are 0 and 1. Where any non-0 value is stored as the 1,0 value is stored as 0. 1 stands for true, 0 for false.

C-Language Basics-data types

Related Article

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.