C Language Chapter I first section understanding variables

Source: Internet
Author: User

Statement: I am a freshman, idle bored. Write a C-language tutorial: A rookie. Big God do not spray!!!

And then we're all going to compile with dev. VC + + is too old, no hint function, bad to start, and always wrong. VS is too big, make a C not, run too slow. Here is the dev download link ... Non-Toxic assured

http://pan.baidu.com/share/link?shareid=1587509971&uk=4169326073

Below to get to the chase ... Recognize variables (the general tutorial begins with Hello World.) Let's just do something.

What are the basic elements of programming language? Look at a table (though no bird uses it.) But know some nouns can also be forced ... )

Natural language Programming languages
Word Letters, numbers, operators, separators
Words or phrases keywords, identifiers, constants
Sentence or paragraph Statement
Chapter Program

1, Keywords (operator what to ignore first)

Keywords (keyword) are also called reserved words (reserved word), is the C language pre-defined (different language keywords, by the language of his father), has a special meaning of the word. Your own definition of the variable name can not be the same as it (like you play lol, someone called the King, you can not call the new king). These keywords are often used in programming ... C89 (standard C, do not know can Baidu) specified the following keywords:

What do these words mean .... You'll find out later.

2. Identifiers

Function: As the name implies, identifiers are used to identify (for example, your name is Xiaoming, xiaoming is your identifier), the identifier is used to identify various things to the compiler use.

Definition: Uppercase and lowercase letters (note that C is case-sensitive), a sequence of characters consisting of numbers and underscores.

Category: 1, System pre-defined identifiers: A word has special meaning but could be redefined (and is not recommened!!) .... Anyway, your variable name cannot be the same as the system-predefined identifier ...

2. User-defined identifier: Used to identify variable name, symbolic constant name, array name, function name, etc.

               Naming rule 1, first character must be letter or underscore

2, see the name of the meaning, do not use Hanyu Pinyin (such as student_num not defined as Teacher_num)

3, cannot be the same as the keyword and the system predefined identifiers.

     EX 8num (wrong: Numbers cannot begin) unsigned (wrong, unsigned is the keyword)! Student (wrong, with illegal characters!) )

Ii. data forms for processing of C language programs

  1, constant (constant)

Definition: The amount of value that cannot be changed in a program

You have to know the data type before you know the constants. So let's start with the data type in the next section. The third section of the constant is introduced.

2. Variables (variable)

Definition: The amount of value that can be changed during program execution.

Basic principles of using variables:1. Variables must be defined first and then used . (It is best to assign an initial value when defined.) Otherwise, the computer will give you random values. If you ignore it, it will cause trouble. Assignment statement later)

               2. C89 stipulates that all variables must be defined before the first executable statement (C99 cancels this rule)

  Variable definition statement:

Type keyword variable name ;(e.g. int A;)

A variable definition statement can define multiple variables of the same type

              Type keyword variable name 1, variable name 2, ...., variable name n;

                   int A, b, C;

int C, B, A;

4 Basic properties of a variable:

1. Variable name: The storage unit used to identify a specific variable in memory, which can be accessed by the variable name (just like your name, knowing your name can find you)

2, the value of the variable (vlue): A variable must have a specific value. In memory, all variable values are stored in binary (e.g. 0000 0000)

3. Type of variable: the type determines the amount of memory allocated by the variable (for example, the size of a variant, the appetite varies), different data types, he occupies a different space size (the following section describes)

4, the address of the variable: the variable in the memory of the specific location (just like your house number, know your house number can find your home)

                            Computer Unified with a unique hexadecimal unsigned integer to identify the address,the memory address of the 32-bit machine is 32 bits, from 0x00000000 to 0xFFFFFFFF

The PS variable introduces so much. The first time to send a bo. Do not like to spray. You are welcome to leave a comment .....

  

C Language Chapter I first section understanding variables

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.