incorrect output
#1

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?
Reply
#2

Use %c specifier for ASCII character.
pawn Код:
printf("%i - %c", i, numbers[i]);
Reply
#3

Never knew about that, thanks a lot!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)