C中赋值表达式的结果是什么? [英] What is the result of an assignment expression in C?

查看:162
本文介绍了C中赋值表达式的结果是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在以下代码中:

int c;
while((c=10)>0)

c = 10 评估为?是1表示值10成功分配给变量c,还是10?为什么?

What does c = 10 evaluate to? Is it 1 which indicates that the value 10 is assigned to variable c successfully, or is it 10? Why?

推荐答案

c = 10是一个返回10的表达式,它也将10分配给c。

c = 10 is an expression returning 10 which also assigns 10 to c.

这篇关于C中赋值表达式的结果是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆