Three laws in C language

xiaoxiao2021-03-06  41

Summary, I feel that I can help beginners see some complicated grammar rules, understand the true meaning of C language.

The first release, not necessarily correct, welcome to discuss, correct, supplement

Patient

Any operation that generates numerical results can be used as an expression, and can be placed in any way that requires numerical results, as long as the numerical type can match

Common, calculations and operations that can generate numerical results

Arithmetic, logic, bit operation, etc.

?:

&, *, Etc.

Return value function

Common places where you need a value:

Value

Condition judgment

Function call

2. Type law

Any type can be used in any type of place

Known special case

Function return value cannot be defined as an array type

Common type

Basic data type, pointer, array, structure ...

Common needs type

Define variables

Define pointers, arrays, and structures

Function parameters and return values

Sizeof

3. Parameter delivery law

The parameter passes when the function call is always called, and the value of the value is copied.

Introduction: the parameters provided by the caller

Conversion: Function Defined Parameters

Basic data types are not suspicious

Struct is also free

When the pointer is used as a parameter, the content of the pointer variable (that is, the memory address it pointing) is copied.

When the array name is used as a parameter, it is equivalent to the pointer.

转载请注明原文地址:https://www.9cbs.com/read-77749.html

New Post(0)