Skip to content

Instantly share code, notes, and snippets.

@airportyh
Created May 17, 2021 15:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save airportyh/abf4afbf22572f186e7e7c6a5286abd4 to your computer and use it in GitHub Desktop.
Save airportyh/abf4afbf22572f186e7e7c6a5286abd4 to your computer and use it in GitHub Desktop.
// https://troydhanson.github.io/uthash/utstring.html
#include "utstring.h"
int main() {
UT_string *str;
utstring_new(str);
char *names[3] = { "Emma", "Marty", "Linus" };
for (int i = 0; i < 3; i++) {
utstring_printf(str, "%d: %s", i + 1, names[i]);
if (i < 2) {
utstring_printf(str, ", ");
}
}
printf("%s\n", utstring_body(str));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment