incorrect output - 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: incorrect output (
/showthread.php?tid=577580)
incorrect output -
PizzaPuntjes - 12.06.2015
I am currently not understanding why it's giving me this result when looping through 4 numbers;
Код:
new numbers[5];
///
numbers = "1234";
for(new i = 0; i < 4; i ++)
{
printf("%i - %s", i, numbers[i]);
}
The output:
Код:
[18:18:34] 0 - 1234
[18:18:34] 1 - 234
[18:18:34] 2 - 34
[18:18:34] 3 - 4
What I need/want to see is:
Код:
0 - 1
1 - 2
2 - 3
3 - 4
Is there anyone that can help me on this issue I am facing?
Re: incorrect output -
Konstantinos - 12.06.2015
Use %c specifier for ASCII character.
pawn Код:
printf("%i - %c", i, numbers[i]);
Re: incorrect output -
PizzaPuntjes - 12.06.2015
Never knew about that, thanks a lot!