c - Format specifier %02x -


i have simple program :

#include <stdio.h> int main() {         long = 16843009;         printf ("%02x \n" ,i); } 

i using %02x format specifier 2 char output, however, output getting is:

1010101  

while expecting :01010101 .

%02x means print @ least 2 digits, prepend 0's if there's less. in case it's 7 digits, no 0 in front.

also, %x int, have long. try %08lx instead.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -