Skip to content

Instantly share code, notes, and snippets.

@sh-cho
Last active November 5, 2017 11:49
Show Gist options
  • Save sh-cho/e4dba99fc396f1c8b08269e50d55de75 to your computer and use it in GitHub Desktop.
Save sh-cho/e4dba99fc396f1c8b08269e50d55de75 to your computer and use it in GitHub Desktop.
c string concatenation using snprintf
#include <stdio.h>
#include <string.h>
int main() {
char prefix[100];
snprintf(prefix, sizeof(prefix), "%s-%s", "main-for","abc");
printf("%s\n", prefix);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment