Skip to content

Instantly share code, notes, and snippets.

@radiofreejohn
Created March 12, 2011 05:33
Show Gist options
  • Save radiofreejohn/867059 to your computer and use it in GitHub Desktop.
Save radiofreejohn/867059 to your computer and use it in GitHub Desktop.
K&R exercise 5-3, strcat
#include <stdio.h>
void *strcatsnot(char *s, const char *t);
void *strcatsnot(char *s, const char *t)
{
while (*++s)
;
while (*s++ = *t++)
;
}
int main()
{
char snot[40] = "why so ";
char blah[] = "cereal?";
strcatsnot(snot, blah);
printf("%s\n", snot);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment