c中的赋值运算符

c的赋值运算符分为简单赋值运算符和复合赋值运算符

简单的赋值运算符:

#include <stdio.h>
int main()
{
  int x=10;
  int y=10;
  x = x*2;
  y = x*2;
  printf("x=%d\n",x);
  printf("y=%d\n",y);
}

复合赋值运算符:

#include <stdio.h>
int main()
{
  int x=10;
  int y=10;
  x *=2;//等价于 x = x*2;
  y *=2;
  printf("x=%d\n",x);
  printf("y=%d\n",y);
}

原创文章,作者:星辰,如若转载,请注明出处:https://www.z88j.com/194.html

(3)
打赏 微信扫一扫 微信扫一扫
上一篇 2021年3月15日 上午12:23
下一篇 2021年3月18日 下午5:31

发表回复

登录后才能评论

Warning: error_log(/www/wwwroot/www.z88j.com/wp-content/plugins/spider-analyser/#log/log-2022.txt): failed to open stream: No such file or directory in /www/wwwroot/www.z88j.com/wp-content/plugins/spider-analyser/spider.class.php on line 2900