RE: [LIP] Doubt in ++ operator
"Abdul Faruk" <[email protected]>
| Newsgroups | gmane.user-groups.linux.india.programmers |
|---|---|
| Message-ID | <D435FC6D9FB6F241B1A75DFB53784ADF03171CB3@EMHQ05C.singtel.corp.root> |
int i=7; int j=i++ * i++; printf("%d",j);
The above set of instruction will give you 7 * 8 = 56.
i++ is an unary operator. (value will be used and the memory will
incremented i++).
(memory incremented and value will be take ++i).
Faruk
Singtel
-----Original Message-----
From: linux-india-programmers-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
[mailto:linux-india-programmers-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org] On Behalf
Of Anand, Dheeraj KumarX
Sent: Monday, July 26, 2004 2:11 PM
To: linux-india-programmers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: RE: [LIP] Doubt in ++ operator
Next time , it should be 9 as you are calling ++ two times.
Dheeraj
-----Original Message-----
From: linux-india-programmers-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
[mailto:linux-india-programmers-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org] On Behalf
Of Vardhman Jain
Sent: Sunday, July 25, 2004 8:41 PM
To: linux-india-programmers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: [LIP] Doubt in ++ operator
Hi,
I have a doubt whether the following code should really be compiler
dependent. int i=7; int j=i++ * i++; printf("%d",j);
I think the answer should always be 49, as the ++ operator comes to
action after the completion of the statement with the ';', But is there
some reason the i++ should increment i before the next i++ is read means
should the second i++ be read as 8 or 7?? Is this behaviour undefined in
c ??
Vardhman
--
*************************************
Vardhman Jain, Btech 4rd Year@IIIT Hyderabad
website: http://students.ac.in/~vardhman
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
linux-india-programmers mailing list
linux-india-programmers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/linux-india-programmers
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_idG21&alloc_id040&op=click