![]() |
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++; |
Re: effect of b = a++ + a++
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 |
Re: 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++; That is "(b= (a++)+(a++))", after that b=2 and a=3; |
Re: effect of b = a++ + a++
On Mon, 21 Jan 2008 14:50:43 +0800,
friendfish <friendfish@gmail.com> 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; 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 |
Re: effect of b = a++ + a++
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 |
Re: effect of b = a++ + a++
On Mon, 21 Jan 2008 01:14:07 -0600, Joachim Schmitz wrote
(in article <fn1go0$8qu$1@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 |
Re: effect of b = a++ + a++
On Jan 20, 3:04*am, Ravi <ra.ravi....@gmail.com> wrote:
> 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. |
Re: effect of b = a++ + a++
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. |
Re: effect of b = a++ + a++
On Jan 20, 10:50*pm, friendfish <friendf...@gmail.com> 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; Please don't answer questions in the newsgroup if you haven't read and understood the FAQ. You look like an ignorant ass who doesn't know anything, and can't be bothered to do as little as three minutes of basic research before submitting an article. |
Re: effect of b = a++ + a++
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 |
| All times are GMT. The time now is 02:01 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.