Raised This Month: $51 Target: $400
 12% 

Should I use ++i or i++ ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TheWho
AlliedModders Donor
Join Date: Jul 2012
Old 09-21-2013 , 12:01   Should I use ++i or i++ ?
Reply With Quote #1

Hey,

I have a short question.

Should I use ++i or i++ ?

In the practise its the same..
TheWho is offline
Pelipoika
Veteran Member
Join Date: May 2012
Location: Inside
Old 09-21-2013 , 12:04   Re: Should I use ++i or i++ ?
Reply With Quote #2

Personally i prefer i++ but i guess it doesnt really matter
Pelipoika is offline
TheWho
AlliedModders Donor
Join Date: Jul 2012
Old 09-21-2013 , 12:09   Re: Should I use ++i or i++ ?
Reply With Quote #3

Thanks.

Did someone have another opinion?
TheWho is offline
thetwistedpanda
Good Little Panda
Join Date: Sep 2008
Old 09-21-2013 , 12:09   Re: Should I use ++i or i++ ?
Reply With Quote #4

It's not the same. ++i will increment the value of i and return it, where as i++ will use the value then increment it.

i = 0;
array[++i] = 3;
j = 0;
array[j++] = 4;

array[0] = 4;
array[1] = 3;
__________________
thetwistedpanda is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 09-21-2013 , 18:21   Re: Should I use ++i or i++ ?
Reply With Quote #5

Best explained in the wiki: http://wiki.alliedmods.net/Introduct...Pawn#Operators
__________________
View my Plugins | Donate
TnTSCS is offline
Reply



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 11:00.


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