Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/61.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C 如何生成一个函数,该函数接收指向将被乘和除的数字的指针?_C_Function_Division_Bit Shift_Multiplication - Fatal编程技术网

C 如何生成一个函数,该函数接收指向将被乘和除的数字的指针?

C 如何生成一个函数,该函数接收指向将被乘和除的数字的指针?,c,function,division,bit-shift,multiplication,C,Function,Division,Bit Shift,Multiplication,我知道我可以通过位向左移位进行乘法,向右移位进行除法,但让我困惑的是指向数字的函数(指针)的参数 void func(unsigned *u) { *u >>= 1; // do the operation on the unsigned value pointed by u. // u contains the address of the object (in this case, the unsigned) } 打电

我知道我可以通过位向左移位进行乘法,向右移位进行除法,但让我困惑的是指向数字的函数(指针)的参数

void func(unsigned *u)
{
   *u >>= 1;        // do the operation on the unsigned value pointed by u.
                    // u contains the address of the object (in this case, the unsigned)
}
打电话

unsigned a = 23;
func(&a);    // pass the pointer to the variable a. After the function executes,
             // a will be changed as the operation is done on it.