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 14 2567 Al***********@g mail.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.stanfo rd.eduwrote:
AliceB.Tok...@g mail.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***********@g mail.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
On Mar 4, 5:48 pm, AliceB.Tok...@g mail.com wrote:
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
Here is what your book actually says:
int i = 5;
int j = 10;
int k = 15;
int l = 5;
....
i == l
j < k
....
The author is saying that the value of the variable "i" is equal to
the value of the variable "l" (the letter l, not the number 1), etc.
The author could probably have picked better variable names.
Robert Gamble Al***********@g mail.com wrote:
On Mar 4, 4:55 pm, Ben Pfaff <b...@cs.stanfo rd.eduwrote:
AliceB.Tok...@g mail.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?
Well my book lists == under relational operators,
Then the "Absolute Beginner's" in the title may well be a statement
about its author.
int i = 5
the follow is true:
i == 1
Of course not.
If the book really makes both of these errors, ditch it. Try K&R
instead.
Richard
Robert Gamble skrev:
On Mar 4, 5:48 pm, AliceB.Tok...@g mail.com wrote:
>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:
[...]
The author is saying that the value of the variable "i" is equal to
the value of the variable "l" (the letter l, not the number 1), etc.
The author could probably have picked better variable names.
Indeed. To give an identifier the name l is very bad practice.
August
Ben Pfaff skrev:
== is not a relational operator (it is an equality operator)
Of course it is -- in the same sense as a car is a vehicle. Other
relational operators are <= and >=.
August
August Karlstrom <fu********@com hem.sewrites:
Ben Pfaff skrev:
>== is not a relational operator (it is an equality operator)
Of course it is -- in the same sense as a car is a vehicle. Other
relational operators are <= and >=.
Not in C.
6.5.8 Relational operators
Syntax
1 relational-expression:
shift-expression
relational-expression < shift-expression
relational-expression shift-expression
relational-expression <= shift-expression
relational-expression >= shift-expression
6.5.9 Equality operators
Syntax
1 equality-expression:
relational-expression
equality-expression == relational-expression
equality-expression != relational-expression
--
Bite me! said C.
Ben Pfaff skrev:
August Karlstrom <fu********@com hem.sewrites:
>Ben Pfaff skrev:
>>== is not a relational operator (it is an equality operator)
Of course it is -- in the same sense as a car is a vehicle. Other relational operators are <= and >=.
Not in C.
6.5.8 Relational operators
Syntax
1 relational-expression:
shift-expression
relational-expression < shift-expression
relational-expression shift-expression
relational-expression <= shift-expression
relational-expression >= shift-expression
6.5.9 Equality operators
Syntax
1 equality-expression:
relational-expression
equality-expression == relational-expression
equality-expression != relational-expression
Laughable
August This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: John Benson |
last post by:
Hi, I've been looking at the "Oracle9 i Database New Features" guide, from
which I quote:
XML Generation
In response to the challenge of generating XML in bulk from a database, XML
generation capabilities have been moved into the database and application
server
kernels and made available as built-in SQL operators. The kernel proximity
of these
operators ensures massively sustainable throughputs, enough for the largest
|
by: Balaji |
last post by:
Dear Jeff,
Thanks for your reply. I see that the PEP and the current docs
specify that __ge__ and __le__ are their own reflection.
Given that PEP 207 proposes rich comparison to handle cases
(brought upon by NumPy) where the objects returned should not be
assumed to be boolean, what is the argument for automatic reflection?
Automatic reflection prevents the resulting objects from being
|
by: glen herrmannsfeldt |
last post by:
The subject recently came up in comp.compilers, though I believe that
I asked here before.
If you use relational operators, other than == and !=, on
pointers to different objects, is there any requirement on
the result?
#include <stdio.h>
int main() {
|
by: Greenhorn |
last post by:
Hi,
Those relational operators have operands of all numerical type
int,char,float etc.
They also are working for character arrays. Whats the logic behind
their working. Is the length of the array compared first and then each
character compared with corresponding character.
{
const char msg = "msessage}", ch = "Za";
|
by: raju |
last post by:
hi
can we compare two integers without using relational operators (== != <
<= > >=)
thanks
rajesh s
| |
by: Robert Abi Saab |
last post by:
Hi everyone. I just finished a course on PostgreSQL and I found out that
PostgreSQL doesn't provide any object relational features (as claimed in
the official documentation), except table inheritance and very limited
user defined types (I defined a UDT with 2 attributes and couldn't use
it in a table, and the trainer said it must contain 1 attribute at most
so that it can be used (as a column) in tables)
So my question is whether...
|
by: jsparks57 |
last post by:
I want to cin two characters for any of the six relational operators.
'>=' no problem or '!=' no problem.
The problem is for reading single character '<' and '>'.
My code wants to read two characters but what works for a second character
for a single character relational operator.
The blank character ' ' is not accepted.
Maybe I should define '<' as '<,' or '<.' to get a simulated second character
for cin to accept?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
| |
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |