Files
vt1200/apps/termtris/tests/fmt.c
T

19 lines
415 B
C

/*
* fmt.c -- Task 2 acceptance: the exact sprintf formats game.c uses.
* Results are NUL-terminated in out[6][16]; tests/fmt.lua prints them.
*/
#include <stdio.h>
char out[6][16];
int main(void)
{
sprintf(out[0], "%10ld", 12345L);
sprintf(out[1], "%2ld", 7L);
sprintf(out[2], "%8ld", 42L);
sprintf(out[3], "%2d. %s %ld", 1, "ab", 99L);
sprintf(out[4], "%-3s", "x");
sprintf(out[5], "%%");
return 0;
}