[Q] Difference beetween %d and %i
#1

I all,

as the title say

Thank you

Max
Reply
#2

%d Is For Numbers And %s Is To Announce a Name Or Item, ILl find out %i cause ive never used that one
Reply
#3

for example:
%d - doube: 2.1 or 23.5
%i - integer: 32 or 49
Reply
#4

Quote:
Originally Posted by Seven_of_Nine
Посмотреть сообщение
for example:
%d - doube: 2.1 or 23.5
%i - integer: 32 or 49
%d + %i - both integer.

Your thing of a float, %f
Reply
#5

%d and %i are identical - assuming you reference to the sscanf2 plugin - both variants scan for a (decimal) integer, signed or not. i prefer %d however, its usage is common practise.
edit: argh, next time i will refresh b4 posting - good to know that there are 2 wrong and 2 true answers now. chose wisely
Reply
#6

So, there isn't a big difference,

i can use %i tho show 500000 as i can use %d ?

Sometimes my sql request bug,

format(query, sizeof(query), "UPDATE `"db_bizs"` SET Price=%i WHERE ID=%d",30000,1);

and it update the price of the biz 1 to 0.

So i ask it could become from the %i

Max
Reply
#7

Quote:
Originally Posted by scott1
Посмотреть сообщение
So, there isn't a big difference,

i can use %i tho show 500000 as i can use %d ?

Max
yes.
Reply
#8

yes, if you want to format a string with %i or %d, then you may use any variant.
any (negative) number (roughly) ranging from -2000000000 upto 2000000000 will work.
Reply
#9

I use them both for the same thing and never found any problem because they both are integars (can be used for integars) but as Babul stated above
Quote:

if you want to format a string with %i or %d, then you may use any variant.

Reply
#10

d = decimal
i = integer

Both do the same.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)