Current location - Health Preservation Learning Network - Fitness coach - Questions about * and&in C language; Understand the meaning of …
Questions about * and&in C language; Understand the meaning of …
* stands for pointer operator and multiplication operator; & stands for address, operator and reference character.

Bitwise and operation used in binary operation;

Monocular means that only one operand is needed, such as: a++a-* a? & ampa

Binocular means that two operands are needed, such as: a+b? a-b a*b? a/b? a%b

Three goals mean that three operands are needed, for example, a = c>b? C: B;

For example: 9&; 5 The writable formula is as follows: 00001001(two's complement of 9)&; 00000101(twos complement of 5) 000001(twos complement of1) can be seen in 9&; 5= 1。

Bitwise AND operation is usually used to clear some bits or keep some bits. For example, clear the upper eight bits of A and keep the lower eight bits. 255 operation (the binary number of 255 is 000000001111165438).

Extended data

Use of operators

1. When the pointer needs to be initialized to point to some objects or functions, the addresses of these objects or functions need to be obtained:

floatx,* ptr

ptr = & ampx; //legal: make the pointer ptr point to X.

ptr = & amp(x+ 1); //Error: (x+ 1) is not a left value.

2. When you have a pointer and want to get the object it refers to, please use *(indirectionoperator *, which is sometimes called dereference operator. Its operand must be a pointer type. If ptr is a pointer, then *ptr is the object or function that ptr points to. If ptr is an object pointer, then *ptr is a left value, which can be regarded as the operand to the left of the assignment operator:

floatx,* ptr = & ampx;

* ptr = 1.7; //Assign 1.7 to the variable x.

++(* ptr); //and add 1 to the value of variable x.

Baidu encyclopedia-operator