关系运算符 [英] Relational Operators

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

问题描述

在我的绝对新手的C指南中,Greg Perry

在哪里说明关系运算符如何工作它给出了

以下示例:


int i = 5;


因此以下陈述为真:


int i == 1


嗯,对我说整数我是5,而5等于1.


有人能帮我理解吗?

谢谢

解决方案

Al *********** @ gmail.com 写道:


在我的绝对初学者Greg Perry的C指南

指示关系运算符如何工作它给出了

以下示例:


int i = 5;


所以以下陈述是正确的:


int i == 1


==不是关系运算符(它是一个相等运算符)和

后者不是声明,也不是有效声明。

你确定你输入的内容与

完全相同这本书?

-

C有它的问题,但从头开始设计的语言也有一些,

我们知道C'的问题。

--Barne Stroustrup


3月4日下午4:55,Ben Pfaff< b。 .. @ cs.stanford.eduwrote:


AliceB.Tok ... @ gmail.com写道:


在我的Absolute Beginner's C指南中由Greg Perry撰写

在哪里说明关系运算符如何工作它给出了

以下示例:


int i = 5;


所以以下陈述为真:


int i = = 1



==不是关系运算符(它是一个相等运算符)和

后者不是声明,也不是它是一个有效的声明。

你确定你输入的内容与

中出现的完全相同吗?

-

C有它的问题,但是从头开始设计的语言也有一些,

我们知道C'的问题。

--Barne Stroustrup




我的书在关系运算符下列出==,我使用的是

单词陈述也直接来自书中。虽然,我很有意识到我没有理解我的语言。无论如何,我的帖子中有一个

的错误,但我认为它不会改变它不是什么事实

有效声明

int i = 5


以下是真实的:


i == 1


Al *********** @ gmail.com 写道:


[我的书指出,给定]

int i = 5


以下是真的:


i == 1



不,这不是真的。也就是说,如果我的值为

,则i == 1为假5.如果你的书真的说明了,那就错了。

-

如果它没有给静态这个词带来新的含义,那么它就不是一个新的C标准。

- C99上的Peter Seebach


In my Absolute Beginner''s Guide to C book by Greg Perry
where it is instruction how relational operators work it gives the
following example:

int i = 5;

so the following statement is true:

int i == 1

Um, to me that says integer i is 5, and 5 is equal to 1.

Can someone help me understand this?
Thanks

解决方案

Al***********@gmail.com writes:

In my Absolute Beginner''s Guide to C book by Greg Perry
where it is instruction how relational operators work it gives the
following example:

int i = 5;

so the following statement is true:

int i == 1

== is not a relational operator (it is an equality operator) and
the latter is not a statement, nor is it a valid declaration.
Are you sure that you''ve typed that in exactly as it appears in
the book?
--
"C has its problems, but a language designed from scratch would have some too,
and we know C''s problems."
--Bjarne Stroustrup


On Mar 4, 4:55 pm, Ben Pfaff <b...@cs.stanford.eduwrote:

AliceB.Tok...@gmail.com writes:

In my Absolute Beginner''s Guide to C book by Greg Perry
where it is instruction how relational operators work it gives the
following example:

int i = 5;

so the following statement is true:

int i == 1


== is not a relational operator (it is an equality operator) and
the latter is not a statement, nor is it a valid declaration.
Are you sure that you''ve typed that in exactly as it appears in
the book?
--
"C has its problems, but a language designed from scratch would have some too,
and we know C''s problems."
--Bjarne Stroustrup



Well my book lists == under relational operators, and my use of the
word statement was also directly from the book. Though, I''m quite
aware that I haven''t got the lingo down. Anyway, there was one
mistake in my post, but I don''t think it changes the fact it isn''t a
valid declaration
int i = 5

the follow is true:

i == 1


Al***********@gmail.com writes:

[My book states that, given]
int i = 5

the follow is true:

i == 1

Nope, it''s not true. That is, i == 1 is false if i has the value
5. If your book really states that, it''s just wrong.
--
"It wouldn''t be a new C standard if it didn''t give a
new meaning to the word `static''."
--Peter Seebach on C99


这篇关于关系运算符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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