|
|
|
|
|
by quietbritishjim
2200 days ago
|
|
> That’s a bit more robust than using strlen(s)+2 strlen wouldn't even be an option if you were formatting something that's not a string e.g. int n;
int prefix_num = 23;
char *line1 = "line 1";
char *line2 = "line 2";
printf("example %d: %n%s\n", prefix_num, &n, line1);
printf("%*s%s\n", n, "", line2);
|
|