SA-MP Forums Archive
format - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: format (/showthread.php?tid=640583)



format - Bussyman - 04.09.2017

Hi,

What is difference between %i and %d ?


Re: format - Zeth - 04.09.2017

There is no difference in it, both are same. Check this for more information.


Re: format - 10MIN - 04.09.2017

Technically there is a difference, but isn't important... The i from %i means integer aka not fractional number. The d from %d means decimal aka numbers in base 10, aka normal numbers.


Re: format - Bussyman - 04.09.2017

So there is not specific situations when should i need to use %i or %d ?


Re: format - Paulice - 04.09.2017

Both are the same, check the wiki.

SpecifierMeaning
%iInteger (whole number)
%dInteger (whole number)
%sString
%fFloating-point number (Float: tag)
%cASCII character
%xHexadecimal number
%bBinary number
%%Literal '%'
%qEscape a text for SQLite. (Added in 0.3.7 R2)



Re: format - Bussyman - 04.09.2017

http://php.net/manual/en/function.sscanf.php

But in php function sscanf they are different? so in sa-mp function sscanf?


Re: format - Paulice - 04.09.2017

"D" there is basically "f" in PAWN (this includes SSCANF).

Use "i" and "d" for integers, use "f" for floating point numbers (or fractions/decimals/whatever).