format
#1

Hi,

What is difference between %i and %d ?
Reply
#2

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

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.
Reply
#4

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

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)
Reply
#6

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

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

"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).
Reply


Forum Jump:


Users browsing this thread: