Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.