42-archive/unikernel-demo/io1/printf/main.c
Louis Solofrizzo e7c0133eac io1: Add printf examples
Signed-off-by: Louis Solofrizzo <lsolofrizzo@online.net>
2019-04-24 12:08:25 +02:00

25 lines
444 B
C

#include <stdio.h>
#ifndef USERSPACE
#define main ukl_main
#endif
typedef struct {
char a;
char *b;
int c;
} test_t;
int main(void) {
char str[250];
test_t test = {
.a = 'a',
.b = "Hello!",
.c = 10
};
printf("a = %c, b = %s, c = %d\n", test.a, test.b, test.c);
snprintf(str, sizeof(str), "a = %c, b = %s, c = %d\n", test.a, test.b, test.c);
puts(str);
return 0;
}