So I was trying to solve the FizzBuzz challenge in various languages using the string method to improve the code. I got stuck in C because things work differently here. This is my code, I'm getting errors, can anyone explain them to me and help to get the correct code.
#include<stdio.h>
#include<string.h>
int main()
{
int i,n;
char output;
printf("Enter Range: ");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
if(i%3==0)
strcat(output,"Fizz");
if(i%5==0)
strcat(output,"Buzz");
if(output=="\0")
strcat(output,i);
printf("\ni");
}
printf("\nEnd.\n");
return 0;
}
Thanks.