左值误差需要解释 [英] lvalue error needs explanation
问题描述
plz cd以下代码
#include< stdio.h>
void main()
{
int x = 4,y = 1;
y = x ++++; //提供所需的错误信息左值
y = x ++ + ++ y; //没有错误
y = x +++++ y ; //需要左值
y =(++ x)++; //没有错误
}
所有四个语句所需的解释和一点点左右的价值。
程序在turbo 4.5 32位编译器上测试。
plz c d following code
#include<stdio.h>
void main()
{
int x=4,y=1;
y=x++++; //gives error message lvalue required
y=x++ + ++y;//no errors
y=x+++++y ;//lvalue required
y=(++x)++; //no errors
}
explanation needed for the all four statements nd a bit bout lvalues.
program tested on turbo 4.5 32 bit compiler.
推荐答案
Akhil写道:
Akhil wrote:
plz cd代码
语法错误:非单词plz。
语法错误:意外的初始c。
语法错误:意外的初始d。
语法错误:命令必须以。结尾。或者!。
警告:四月是最残酷的一个月。
#include< stdio.h>
void main()
非int`main`s产生未定义的行为。
{
int x = 4,y = 1;
y = X ++++; //给出错误消息左值
左值 (粗略地)是一个可寻址的对象,一个变量。
++的左操作数必须是左值。 ++
的结果是一个数字。数字不是左值。 QED。
程序在turbo 4.5 32位编译器上测试。
plz c d following code
Syntax error: non-word "plz".
Syntax error: unexpected initial "c".
Syntax error: unexpected initial "d".
Syntax error: imperative must end with "." or "!".
Warning: April is the cruelest month.
#include<stdio.h>
void main()
non-int `main`s produce undefined behaviour.
{
int x=4,y=1;
y=x++++; //gives error message lvalue required
An "lvalue" is (roughly) an addressable object, a variable.
The left operand of ++ must be a lvalue. The result of ++
is a number. Numbers are not lvalues. QED.
program tested on turbo 4.5 32 bit compiler.
如果是程序,它会编译。
-
克里斯尝试,或尝试不 - 没有做 Dollin
If it were a program, it would have compiled.
--
Chris "try, or try not -- there is no do" Dollin
thnx for d reply但是我仍然有问题....
如果我们执行语句y =( ++ X)++;然后thr是没有错误++ x将
再次ba number nd左操作数++ shud ba lvalue所以你这样做
在这种情况下工作。
thnx for d reply but i still hav a problem ....
if we exeucte the statement y=(++x)++; then thr is no error ++x will
again b a number nd left operand of ++ shud b a lvalue so y does it
work in this case.
Akhil写道:
Akhil wrote:
thnx for d reply但是我仍然有问题....
是的,你还在写gobbledegook。请使用英语单词
和英语语法。
如果我们执行语句y =(++ x)++;然后thr没有错误
是的,有 - 增量中的无效左值是我的本地gcc如何报告
它。
++ x将
再次ba数nd左操作数++ shud ba lvalue所以你做的是
thnx for d reply but i still hav a problem ....
Yes, you''re still writing in gobbledegook. Please use English words
and English grammar.
if we exeucte the statement y=(++x)++; then thr is no error
Yes, there is - "invalid lvalue in increment" is how my local gcc reported
it.
++x will
again b a number nd left operand of ++ shud b a lvalue so y does it
work in this case.
破碎的编译器 - /如果/它确实有效。
-
克里斯尝试,或尝试不 - 没有做 Dollin
Broken compiler - /if/ it really did work.
--
Chris "try, or try not -- there is no do" Dollin
这篇关于左值误差需要解释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!