Implement %c formatter

This commit is contained in:
Alex Kotov 2020-12-07 04:58:34 +05:00
parent 298761e5e4
commit 0eb355f1fa
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
2 changed files with 6 additions and 0 deletions

View File

@ -199,6 +199,10 @@ void kernaux_printf_va(
putchar(*arg_ptr);
}
}
else if (formatter.type == TYPE_c) {
const char arg = va_arg(va, int);
putchar(arg);
}
}
putchar('\0');

View File

@ -40,6 +40,8 @@ int main()
test("", "");
test("Hello, World!", "Hello, World!");
test("Hello, Alex!", "Hello, %s!", "Alex");
test("Hello, Alex!", "Hello, %c%c%c%c!", 'A', 'l', 'e', 'x');
return 0;
}