一个基本问题,需要帮助 [英] a basic question,need help

查看:59
本文介绍了一个基本问题,需要帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道在c plus plus中,++ x返回l值而x ++返回r-

值,但c中的情况是++ x和x ++返回r -

值?我不知道C99如何定义它,thx。

i know that in c plus plus,++x returns l-value while x++ returns r-
value,but what is the situation in c,are both ++x and x++ return r-
value? i don''t know how C99 defines it,thx.

推荐答案

jackie写道:
jackie wrote:

i知道在c plus plus中,++ x返回l值而x ++返回r-

值,但c中的情况是++ x和x ++返回r-

值?我不知道C99如何定义它,thx。
i know that in c plus plus,++x returns l-value while x++ returns r-
value,but what is the situation in c,are both ++x and x++ return r-
value? i don''t know how C99 defines it,thx.



在C(所有版本)中,++ x和x ++都不是左值。

听到这个我很惊讶在C ++中是不同的,因为

对我来说没有意义。


int x = 42;

++ x = 97;


在C ++中合法吗?如果是这样,之后x的价值是多少?

(实际上,你可以忽略第二个问题:如果

对第一个问题的回答是否以外的其他问题,我不想

想要了解更多关于C ++的信息。


-

Eric Sosman
es*****@ieee-dot-org.inva 盖子


[cuitao @ mytest c]
[cuitao@mytest c]


vi pp.c


#include< stdio.h> ;

int main()

{

int x = 10;

x = 20;

printf(" \ nx =%d \ n",x);


返回0;

}

~

~

~

" pp.c" 9L,99C写的

[cuitao @ mytest c]
vi pp.c

#include <stdio.h>
int main()
{
int x=10;
x=20;
printf("\nx=%d\n",x);

return 0;
}
~
~
~
"pp.c" 9L, 99C written
[cuitao@mytest c]


这篇关于一个基本问题,需要帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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