mirror of
https://github.com/tailix/libkernaux.git
synced 2025-02-24 15:55:41 -05:00
Implement %c formatter
This commit is contained in:
parent
298761e5e4
commit
0eb355f1fa
2 changed files with 6 additions and 0 deletions
|
@ -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');
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue