if and for statements

P

Paminu

is this:
....
....
....
for (i = 0; i <16; i++)
{
if (arg & j) a++;
j <<= 2;
}

return (a & 1);
....
....
....

the same as:
for (i = 0; i <16; i++)
{
if (arg & j)
{
a++;
}

j <<= 2;

}

return (a & 1);
 
C

Christopher Benson-Manica


It is proper Usenet etiquette to include the text you are replying to.
To do this using Google groups, please follow the instructions below,
penned by Keith Thompson:

If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers.
 
K

Kenneth Brody

Paminu said:
[... code that differs only at ...]
if (arg & j) a++;
[...and...]

if (arg & j)
{
a++;
}

[... the same? ...]

Yes.

--
+-------------------------+--------------------+-----------------------------+
| Kenneth J. Brody | www.hvcomputer.com | |
| kenbrody/at\spamcop.net | www.fptech.com | #include <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------------+
Don't e-mail me at: <mailto:[email protected]>
 
B

Barry Schwarz

is this:
...
...
...
for (i = 0; i <16; i++)
{
if (arg & j) a++;
j <<= 2;
}

return (a & 1);
...
...
...

the same as:
for (i = 0; i <16; i++)
{
if (arg & j)
{
a++;
}

Yes. If the "range" of the if is a single statement, the braces are
optional.
j <<= 2;

}

return (a & 1);


<<Remove the del for email>>
 
P

Peter Shaggy Haywood

Groovy hepcat Keith Thompson was jivin' on Tue, 04 Oct 2005 20:46:43
GMT in comp.lang.c.
Re: if and for statements's a cool scene! Dig it!
Yes, Sir?

Yes, Sir, three bags full, Sir. :)

--

Dig the even newer still, yet more improved, sig!

http://alphalink.com.au/~phaywood/
"Ain't I'm a dog?" - Ronny Self, Ain't I'm a Dog, written by G. Sherry & W. Walker.
I know it's not "technically correct" English; but since when was rock & roll "technically correct"?
 
P

pete

Peter said:
Groovy hepcat Keith Thompson was jivin' on Tue, 04 Oct 2005 20:46:43
GMT in comp.lang.c.
Re: if and for statements's a cool scene! Dig it!


Yes, Sir, three bags full, Sir. :)

One for the little boy who lives down the drain.

"Lane" was not in my vocabulary when I learned this.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top