Could anyone possibly provide feedback on my code given below? I have done the Fibonacci series multiple times in other languages, but for some odd reason, it won't print the correct series when I code it in C. I can't seem to figure out what I did wrong.
#include <stdio.h>
int fibonacci (int n)
{
(int i = 0; i < n; i++)
{
if (i == 0 || i == 1)
{
printf("%d,", i);
else
{
printf("%d,", ((i-1) + (i-2)));
}
}
}
int main ()
{
int (*fnctPtr)(int number);
fnctPtr = &fibonacci;
fnctPtr(9);
return 0;
}