Skip to content

Instantly share code, notes, and snippets.

@eatnumber1
Last active August 29, 2015 14:09
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 eatnumber1/e6bdb7dfd67fa1401739 to your computer and use it in GitHub Desktop.
Save eatnumber1/e6bdb7dfd67fa1401739 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void) {
int wins = 2;
char *s = "good ";
char *p = malloc(wins * strlen(s) + 1);
for (int i = 0; i < wins; i++) p = strcat(p, s);
printf("%s\n", p);
free(p);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment