Skip to content

Instantly share code, notes, and snippets.

@Fahrni
Created November 16, 2014 00:11
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 Fahrni/14650fd5a65a21798570 to your computer and use it in GitHub Desktop.
Save Fahrni/14650fd5a65a21798570 to your computer and use it in GitHub Desktop.
FizzBuzz
static void FizzBuzz()
{
static int kBufferMax = 256;
char outputBuffer[kBufferMax];
for (int x = 1; x <= 100; x++)
{
memset(&outputBuffer, 0, kBufferMax);
if (0 == (x % 3))
{
strcpy(outputBuffer, "Fizz");
}
if (0 == (x % 5))
{
strcat(outputBuffer, "Buzz");
}
if (outputBuffer[0])
{
printf("%s - value %d\n", outputBuffer, x);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment