fix printf for 0
This commit is contained in:
parent
8f5c68efaf
commit
bff505fb40
@ -34,6 +34,9 @@ void printInt(int integer)
|
|||||||
if (integer < 0) {
|
if (integer < 0) {
|
||||||
printChar('-');
|
printChar('-');
|
||||||
}
|
}
|
||||||
|
if (integer == 0){
|
||||||
|
num[i++] = 0;
|
||||||
|
}
|
||||||
while (integer != 0) {
|
while (integer != 0) {
|
||||||
int digit = integer % 10;
|
int digit = integer % 10;
|
||||||
num[i++] = (digit > 0) ? digit : -digit;
|
num[i++] = (digit > 0) ? digit : -digit;
|
||||||
|
Loading…
Reference in New Issue
Block a user