Open AmmarHaddadi opened 4 days ago
+
d i
printf("%+d\n", 42); // "+42" printf("%+d\n", -42); // "-42"
Note:
Example test cases:
printf("|%#10x|\n", 42); // | 0x2a2a| printf("|%+10d|\n", 42); // | +42| printf("| %10d|\n", 42); // | 42|
no need to hack into itoa(), just check if it returns a string that doesn't start with - and print +
itoa()
-
+
(Plus flag)d i
Note:
Example test cases: