Raised This Month: $ Target: $400
 0% 

++variable?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 07-14-2010 , 16:06   ++variable?
Reply With Quote #1

Hello!

I saw this two times today:

PHP Code:
if(++integer_example == blablahhhh
Is this like?

Code:
If the integer_example + 1 == Blablabla
so int_example++ and ++int_example are the same?
__________________
Quote:
#define true ((rand() % 2)? true: false) //Happy debugging suckers
mottzi is offline
Send a message via MSN to mottzi
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 07-14-2010 , 16:11   Re: ++variable?
Reply With Quote #2

No, they are not the same.
Code:
y = ++variable + x
Means
Code:
variable = variable + 1
y = variable  + x
And

Code:
y = variable++ + x
Means
Code:
y = variable + x
variable = 1 + variable
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.

Last edited by ot_207; 07-14-2010 at 16:15.
ot_207 is offline
PattyBiena
BANNED
Join Date: Jul 2010
Location: Argentina
Old 07-14-2010 , 16:12   Re: ++variable?
Reply With Quote #3

if ( (variable + 1) == blabla )
PattyBiena is offline
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 07-14-2010 , 16:24   Re: ++variable?
Reply With Quote #4

thank you very much
__________________
Quote:
#define true ((rand() % 2)? true: false) //Happy debugging suckers
mottzi is offline
Send a message via MSN to mottzi
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:15.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode