Three laws in C language

zhaozj2021-02-11  168

I have summed up, I feel that I can help beginners to see some complicated grammar rules, understand the true meaning of the C language, 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. have a function of return value

Common places where you need a value:

Assignment condition judgment function call

2. Type law

Any type can be used in any of the needs type; use any type-defined variables to take up memory

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 variable definitions pointers, arrays, and structural 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.

Conference: Parameters provided by the caller: Function defined parameters Basic data types are unable to quench Struct does not have to check the pointer as a parameter, the contents of the pointer variable (that is the memory address it point to the memory) are used as a copy number. When the parameter is equal, it is equivalent to the pointer.

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

New Post(0)