473,396 Members | 2,115 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

effect of b = a++ + a++

what is the effect of fllowing code n values of a and b
b = 0;
a = 1;
b = a++ + a++;
Jan 20 '08 #1
8 3211
Ravi wrote:
what is the effect of fllowing code n values of a and b
b = 0;
a = 1;
b = a++ + a++;
Please refer to section 3 (Expressions) of the FAQ. Here is a link to
the same: http://www.c-faq.com/expr/index.html.

Regards,
Vi
Jan 20 '08 #2
what is the effect of fllowing code n values of a and b
b = 0;
a = 1;
b = a++ + a++;
That is "(b= (a++)+(a++))", after that b=2 and a=3;
Jan 21 '08 #3
On Mon, 21 Jan 2008 14:50:43 +0800,
friendfish <fr********@gmail.comwrote:
>
>what is the effect of fllowing code n values of a and b
b = 0;
a = 1;
b = a++ + a++;
That is "(b= (a++)+(a++))", after that b=2 and a=3;
Neither the C standard or the FAQ agree with you.

Maybe on your particular compiler it works like that, but you have no
guarantee that it will work like that anywhere else.

See another post in this same thread for a reference to the C FAQ that
explains why you should not do this.

Martien
--
|
Martien Verbruggen | Louis Pasteur's theory of germs is ridiculous
| fiction -- Pierre Pachet, Professor of
| Physiology at Toulouse, 1872
Jan 21 '08 #4
friendfish wrote:
>what is the effect of fllowing code n values of a and b
b = 0;
a = 1;
b = a++ + a++;
That is "(b= (a++)+(a++))", after that b=2 and a=3;
Not neccessarily. Read the FAQs as mentioned by a previous poster.

Bye, Jojo
Jan 21 '08 #5
On Mon, 21 Jan 2008 01:14:07 -0600, Joachim Schmitz wrote
(in article <fn**********@online.de>):
friendfish wrote:
>>what is the effect of fllowing code n values of a and b
b = 0;
a = 1;
b = a++ + a++;
That is "(b= (a++)+(a++))", after that b=2 and a=3;
Not neccessarily. Read the FAQs as mentioned by a previous poster.
I get this from the compiler:
b.c: In function Œmain¹:
ub.c:10: warning: operation on Œa¹ may be undefined

'May' being an interesting spin on things.

--
Randy Howard (2reply remove FOOBAR)
"The power of accurate observation is called cynicism by those
who have not got it." - George Bernard Shaw

Jan 21 '08 #6
On Jan 20, 3:04*am, Ravi <ra.ravi....@gmail.comwrote:
what is the effect of fllowing code n values of a and b
b = 0;
a = 1;
b = a++ + a++;
The effect is that it stupefies the reader to the point that he's
unable to read the FAQ or operate the Google search engine.

Jan 21 '08 #7
friendfish wrote:
>
>what is the effect of fllowing code n values of a and b
b = 0;
a = 1;
b = a++ + a++;
That is "(b= (a++)+(a++))", after that b=2 and a=3;
No, after that the value of b is undefined. Please learn about sequence
points.

This is yet another example of a tiresome error adequately discussed in
the FAQ. Unfortunately, the same people that "know" what this
ill-formed code means are the same ones who won't bother reading the FAQ
or following the newsgroup before posting.
Jan 21 '08 #8
friendfish wrote:
>
>what is the effect of fllowing code n values of a and b
b = 0;
a = 1;
b = a++ + a++;

That is "(b= (a++)+(a++))", after that b=2 and a=3;
No. The only effect is undefined behaviour. Anything at all can
happen. You could find yourself 6 mos. pregnant (although the
likelihood is probably low).

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.

--
Posted via a free Usenet account from http://www.teranews.com

Jan 22 '08 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Susanna | last post by:
Hi all, I'm using the following slideshow script that I found on the web to display changing images with a crossfade effect. Eventually I will be adding many more images to the slideshow. The...
8
by: pertheli | last post by:
I am in a situation where only "goto" seems to be the answer for my program logic where I have to retry calling some repeated functions. Can anybody help in the usage of goto and its effect in...
7
by: Gary Duncan | last post by:
Hi all, My first incursion into this group so apologies if the following question is misplaced. That is, I'm trying to find some free javascript which implements the "ken burns effect" on...
14
by: Charles Douglas Wehner | last post by:
If you go to http://www.netscape.com and search for Wehner, you will find my site. It will say http://wehner.org You click to preview, and find that my home page is too big for the preview...
10
by: Gary Duncan | last post by:
A few months ago - if memory serves - I posted a query here as to whether anyone had a bit of Javascript which could be used to render this effect on an image in a WEB-browser. Didn't get the...
16
by: eholz1 | last post by:
Hello CSS group, I saw a beautiful effect that I would like to use either by CSS or using photoshop to create the image/effect (maybe even imagemagick) the site address is:...
3
by: Beamer | last post by:
Hi I am trying to build a roating slide effect in javascript. Basically, I have a list like below <ul id="slideShowCnt"> <li id="slide0"><img .../></li> <li id="slide0"><img .../></li> <li...
3
by: Gandalf | last post by:
Sharp effect is one of the photoshop effect on letters. some one a javascript script that create the same effect? thanks
7
by: nolo contendere | last post by:
the alert message appears before the Effect.SlideUp even begins. How can I ensure that the SlideUp completes before executing the next statement? I've tried setTimeout, and I can kind of get it to...
2
by: AndrewC | last post by:
I am using the Scriptaculous/Prototype libraries to build a project and I really want to have an effect like the mootools download page (http://www.mootools.net/download) where when you mouse over...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
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,...
0
jinu1996
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.