C language study notes - pre-school knowledge Overview

I will do when freshman learning C language used to share notes with you, compare the contents of plain, more suitable for beginners, but please forgive me if wrong, proposed corrections, thank you!

Introduction: This note is a C language for beginners or some of the highlights of my record in the self common mistakes, I hope this note can be helpful to you in learning C language.

C language learning notes

C language focus: process control, functions, pointers, dynamic memory allocation.

The first chapter, an overview of pre-school knowledge

tips

         1. How to read a program?

            Processes, functions, test number (see by thinking of a computer program)

         2. The essence of the variables is the memory of a storage space

         3. The operating system allocates memory to assign usage rights to a piece of the program memory space;

            The release of the operating system memory usage rights allocated to the program memory space to recover, and then the program will not be able to use this piece of memory space.

            Note: allocate memory refers to memory allocation rights, the release of memory is not the contents of the memory is cleared, the original data is retained and become garbage data, the so-called free memory memory does not mean there is no content, but can not be occupied for memory allocation, although there is garbage, but the operation is assigned to the program so that the program can modify the permissions garbage data memory space for the program to continue to use.

            Memory is directly controlled by the operating system, since Windows 2000, the operating system does not allow programs to directly access memory, and the memory can only be accessed by requesting the operating system before Windows 98 and Windows ME and so allow the program to directly access through the operating system and memory memory access in two ways.

Common operators

Arithmetic operators:

+ - × /% (taking the remainder)

Relational operators:

>> = <<=! = (Not equal) == (equal)

(3 == 5 Boolean value, that is, 0) is zero true zero false; really represents 1, 0 represents false.

Note: = Assignment == is equal before

Logical Operators:

! (Non) && (and) || (or)

Note: Results logical operators and relational operators can only be true or false, is represented by a true, false with 0, i.e. set up or does not hold. Often used in the if and while.

Assignment operator:

= + = (Plus etc.) - = (minus the like) * = (multiplication, etc.) / = (except the like)

a+=3 :== a=a+3

a/=5 :== a=a/3

And not less than 80 or greater represents 90 i.

Priority: Arithmetic> Relations> Logic> assignment

Note brackets! ! !

         int m;

         int k = 10;

         m = (21> 3) && (k = 5); // m is a Boolean value, k =. 5 is true if and only if k = 0 if false, i.e. 0 is false, true number of other

         printf ( "m =% d, k =% d \ n", m, k); // can not be left when the truth value of m is determined, before the implementation of the right side; i.e., if the left can determine the truth value of m, the right It is not executed.

&& left expression is false, the expression on the right certainly will not be executed

|| left expression is true, the expression on the right certainly will not be executed

 

Mandatory Conversion: :( data format type) (expression)

         you;

         floatsum = 0; Function: the type of the expression of the foregoing type mandatory data type conversion specified

         for(i=1;i<=100;++i)

         //sum= sum + 1.0/i;

         sum = sum + 1 / (float) (i); // mandatory type i into the float.

         printf ( "sum =% f \ n", sum); // float must% f (or% lf) control output

Input control characters:

printf and scanf in the output (input) control, control symbols and the latter value corresponded to the foregoing.

scanf ( "% d% d% d", & i, & j, & k); // Assignment continuous space, a carriage return after the point may be assigned a more convenient.

scanf ( "% d,% d,% d", & i, & j, & k); // this band must enter the non-input control character ",", or can not complete the assignment of the three variables.

 

doubledelta;

     printf ( "Please enter the delta values:");

     scanf ( "% lf", & delta); // defined above delta Why type variable must be used to control what type of character input control, otherwise it will go wrong! ! !

 

Note: input / output control symbol and the input / output parameters must correspond

Note scanf () the address-identifier &

 

int 98 --- default decimal

int 098 --- octal

int 0x (X) 98 --- Hex

About College will be fruit

True to its word, line must be fruit, fruit is the purpose of our school we will focus on the training institute zero-based IT learning for senior staff engineer working IT professional C / C ++ / Python training relates to the field of client / server development, embedded , digital image processing, audio and video, linux, windows, things, reverse, chain blocks and each area has a large number of practical projects to enhance the integrity of the participants in the project combat.

Plus group to obtain information:

Hong Meng beginning split --Linux legendary history

 

Technical Information:

1, linux related technical information

Hong Meng beginning split --Linux legendary history

 

2, block chain related information

Hong Meng beginning split --Linux legendary history

 

3, C / C ++ QT / UI related information

Hong Meng beginning split --Linux legendary history

 

4, software engineering data

Hong Meng beginning split --Linux legendary history

Output control characters:

% X (X): Output hexadecimal integer (capitalization)% # x (X): output Ox (X) hexadecimal integer

% D: integer input and output

% Ld: long integer

% Hd: short integer

% Hu: unsigned int

% U% lu% s: string of input and output

% C: character output

% F: floating point O

% Lf: double precision floating point

Character Storage:

Complement integer is converted to the form of binary code stored in the computer;

IEEE754 standard real number is converted to binary code stored in the computer;

The actual nature of the characters is the same as the storage integers.

Guess you like

Origin www.cnblogs.com/AdBingo/p/12597588.html