A summary of C language learning

Source: Internet
Author: User

1. Data type

The data type is the type of the variable, and he will decide to store that type of data for that variable;

There are several common types of data:

Shaping (representing integers):

int 4 bytes

Short 2 bytes

Long 4 bytes

Floating point type (for decimals):

Double 8 bytes

Float 4 bytes

Character type (denotes character):

Char 1 bytes

The storage range for each data type is:

Unsigned (positive number only): 0~2^ (bytes *8)-1

Signed (can be expressed plus/minus): -2~ (bytes *8/2) ~2^ (bytes *8/2)-1

2. Arrays

An array is a collection of the same data types;

The Declaration method is: data type variable name [] = {element 1 initialized value, element 2 initialized value ...}; You can also initialize the data type variable name [ array length ] = {0};

When you need to use a member of an array, you can obtain an element of the array by using the variable name [subscript] (an integer that is effectively labeled 0 to the array length-1)

3. Character Manipulation

In c language, the definition of a string is a character array;

The declared method is a char string name [] = "string Content", or char string name [string length] = {0};

If you use the second way of declaring, you can store the character space just as long as the string length-1 (because the string must end with ' \ S ' and occupy one character)

String.h header file, there are some functions related to string manipulation which have copies, comparisons, strings and numeric conversions, etc.

4. Library functions

The library function is the compiler comes with some functions, the use of the need to declare the corresponding header file;

A summary of C language learning

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.