Improve examples

This commit is contained in:
Alex Kotov 2020-12-07 05:28:44 +05:00
parent de6e1a02d4
commit 75a573a9e0
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
2 changed files with 2 additions and 10 deletions

View File

@ -8,7 +8,7 @@
#define BUFFER_SIZE 1024
static char buffer[BUFFER_SIZE];
static unsigned int buffer_index;
static unsigned int buffer_index = 0;
static void my_putchar(const char chr)
{
@ -18,12 +18,8 @@ static void my_putchar(const char chr)
int main()
{
memset(buffer, '\0', sizeof(buffer));
buffer_index = 0;
kernaux_printf(my_putchar, "Hello, %s! Session ID: %u.", "Alex", 123);
assert(strcmp(buffer, "Hello, Alex! Session ID: 123.") == 0);
printf("OK!\n");
return 0;
}

View File

@ -8,7 +8,7 @@
#define BUFFER_SIZE 1024
static char buffer[BUFFER_SIZE];
static unsigned int buffer_index;
static unsigned int buffer_index = 0;
static void my_putchar(const char chr)
{
@ -26,12 +26,8 @@ static void my_printf(const char *const format, ...)
int main()
{
memset(buffer, '\0', sizeof(buffer));
buffer_index = 0;
my_printf("Hello, %s! Session ID: %u.", "Alex", 123);
assert(strcmp(buffer, "Hello, Alex! Session ID: 123.") == 0);
printf("OK!\n");
return 0;
}