Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cocoa/3.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_Variables_Variable Assignment - Fatal编程技术网

C 用不同的方式表示变量赋值

C 用不同的方式表示变量赋值,c,variables,variable-assignment,C,Variables,Variable Assignment,变量赋值(如x=x*3)如何以不同的方式表示?这里是另一种方式: x *= 3; 同样地 x += 3; // it is the same as x = x + 3; x -= 3; // it is the same as x = x - 3; x /= 3; // it is the same as x = x/3; 张贴你尝试过的内容。我相信我们可以找到更多。而且,如果结果是一样的,对于这么小的东西,我猜优化不是目标,只要按照你知道的和有效的方法去做就行了。学习10种不同的方法来避免

变量赋值(如x=x*3)如何以不同的方式表示?

这里是另一种方式:

x *= 3;
同样地

x += 3; // it is the same as x = x + 3;
x -= 3; // it is the same as x = x - 3;
x /= 3; // it is the same as x = x/3;

张贴你尝试过的内容。我相信我们可以找到更多。而且,如果结果是一样的,对于这么小的东西,我猜优化不是目标,只要按照你知道的和有效的方法去做就行了。学习10种不同的方法来避免一次或两次击键没有意义。x=x*3作为变量声明没有多大意义。或者你说的是赋值?x*=3,x=x+xfori=0;我