C Study Notes

Source: Internet
Author: User

Variable

In the C language, variables must be defined and used before they must be initialized.

int i; i = 10;

Under C99 rules, variables can be initialized directly after they are defined.

int ten;

When a global variable is not initialized, the default initial value is 0.

data types and input and output

Integer data is decorated with unsigned, which indicates that the variable is an unsigned integer, which is a positive integer.

Input and output:

unsigned:u%

Octal: o%

Hex: X

The i% can automatically identify the input data in order to output.

Char is essentially an integral type. The lowercase letter and the uppercase itself differ by 32.

Char ' a ' ; Char ' A ' ;p rintf ("%d\n", A-B);

The run result is 32.

The case conversion of a character can be achieved by adding or minus 32.

Enum: enum

Union: Union

struct: Structure

structStudent {Charname[Ten]; intAge ;        }; //Accessing structure interior elements    structStudent S = {"xiaoming", -}; intAge =S.age; //accessing structure interior elements with struct pointers    structStudent *p; P= &s; intA = p->age;

typedef: Alias a type

    // Mystudent represents the struct student.    struct student mystudent;     = {"xiaoming",+};

Const: Modified object immutable, nearest principle

extern: External declarations

C Study Notes

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.