In a for loop, I am trying to use printf to print the current i value. This line: printf((char *) i);
is giving me runtime errors. Why is this?!
Below is a quick fizzbuzz solution that is doing this:
void FizzBuzz()
{
for (int i = 0; i < 20; i++)
{
printf((char *)i);
if ((i % 3 == 0) && (i % 5 == 0))
{
printf("FizzBuzz \n");
}
else if (i % 3 == 0)
{
printf("Fizz \n");
}
else if (i % 5 == 0)
{
printf("Buzz \n");
}
else
{
printf("%d\n", i);
}
}
}