Consider documenting this function with something like Doxygen doxygen. At a quick glance, your function can be interpreted two different ways: Print out fib(0)
, fib(1)
, ..., or print out all Fibonacci numbers less than or equal to max_num
. Documentation will clarify that.
max_num
will never be negative. It is defined as an unisignedunsigned int
, which means it can never hold a negative value. So this:
if (max_num < 0)
{
fprintf(stderr, "Please, enter a non-negative number\n");
return;
}
will never happen. (Try calling fib(-2)
, see what happens)
(Optional) Put size_t count = 0
inside the loop if you can? (You may have to add -std=c99
or something like that to make it work)
for (size_t count = 0; count <= max_num; count++)
{
printf("%lu\n", fib_num);
fib_num += fib_temp;
fib_temp = fib_num - fib_temp;
}
Consider documenting this function with something like Doxygen. At a quick glance, your function can be interpreted two different ways: Print out fib(0)
, fib(1)
, ..., or print out all Fibonacci numbers less than or equal to max_num
. Documentation will clarify that.
max_num
will never be negative. It is defined as an unisigned int
, which means it can never hold a negative value. So this:
if (max_num < 0)
{
fprintf(stderr, "Please, enter a non-negative number\n");
return;
}
will never happen. (Try calling fib(-2)
, see what happens)
(Optional) Put size_t count = 0
inside the loop if you can? (You may have to add -std=c99
or something like that to make it work)
for (size_t count = 0; count <= max_num; count++)
{
printf("%lu\n", fib_num);
fib_num += fib_temp;
fib_temp = fib_num - fib_temp;
}
Consider documenting this function with something like doxygen. At a quick glance, your function can be interpreted two different ways: Print out fib(0)
, fib(1)
, ..., or print out all Fibonacci numbers less than or equal to max_num
. Documentation will clarify that.
max_num
will never be negative. It is defined as an unsigned int
, which means it can never hold a negative value. So this:
if (max_num < 0)
{
fprintf(stderr, "Please, enter a non-negative number\n");
return;
}
will never happen. (Try calling fib(-2)
, see what happens)
(Optional) Put size_t count = 0
inside the loop if you can? (You may have to add -std=c99
or something like that to make it work)
for (size_t count = 0; count <= max_num; count++)
{
printf("%lu\n", fib_num);
fib_num += fib_temp;
fib_temp = fib_num - fib_temp;
}
Consider documenting this function with something like Doxygen. At a quick glance, your function can be interpreted two different ways: Print out fib(0)
, fib(1)
, ..., or print out all Fibonacci numbers less than or equal to max_num
. Documentation will clarify that.
max_num
will never be negative. It is defined as an unisigned int
, which means it can never hold a negative value. So this:
if (max_num < 0)
{
fprintf(stderr, "Please, enter a non-negative number\n");
return;
}
will never happen. (Try calling fib(-2)
, see what happens)
(Optional) Put size_t count = 0
inside the loop if you can? (You may have to add -std=c99
or something like that to make it work You may have to add -std=c99
or something like that to make it work)
for (size_t count = 0; count <= max_num; count++)
{
printf("%lu\n", fib_num);
fib_num += fib_temp;
fib_temp = fib_num - fib_temp;
}
Consider documenting this function with something like Doxygen. At a quick glance, your function can be interpreted two different ways: Print out fib(0)
, fib(1)
, ..., or print out all Fibonacci numbers less than or equal to max_num
. Documentation will clarify that.
max_num
will never be negative. It is defined as an unisigned int
, which means it can never hold a negative value. So this:
if (max_num < 0)
{
fprintf(stderr, "Please, enter a non-negative number\n");
return;
}
will never happen. (Try calling fib(-2)
, see what happens)
(Optional) Put size_t count = 0
inside the loop if you can? (You may have to add -std=c99
or something like that to make it work)
for (size_t count = 0; count <= max_num; count++)
{
printf("%lu\n", fib_num);
fib_num += fib_temp;
fib_temp = fib_num - fib_temp;
}
Consider documenting this function with something like Doxygen. At a quick glance, your function can be interpreted two different ways: Print out fib(0)
, fib(1)
, ..., or print out all Fibonacci numbers less than or equal to max_num
. Documentation will clarify that.
max_num
will never be negative. It is defined as an unisigned int
, which means it can never hold a negative value. So this:
if (max_num < 0)
{
fprintf(stderr, "Please, enter a non-negative number\n");
return;
}
will never happen. (Try calling fib(-2)
, see what happens)
(Optional) Put size_t count = 0
inside the loop if you can? (You may have to add -std=c99
or something like that to make it work)
for (size_t count = 0; count <= max_num; count++)
{
printf("%lu\n", fib_num);
fib_num += fib_temp;
fib_temp = fib_num - fib_temp;
}
Consider documenting this function with something like Doxygen. At a quick glance, your function can be interpreted two different ways: Print out fib(0)
, fib(1)
, ..., or print out all Fibonacci numbers less than or equal to max_num
. Documentation will clarify that.
max_num
will never be negative. It is defined as an unisigned int
, which means it can never hold a negative value. So this:
if (max_num < 0)
{
fprintf(stderr, "Please, enter a non-negative number\n");
return;
}
will never happen. (Try calling fib(-2)
, see what happens)
(Optional) Put size_t count = 0
inside the loop if you can? (You may have to add -std=c99
or something like that to make it work)
for (size_t count = 0; count <= max_num; count++)
{
printf("%lu\n", fib_num);
fib_num += fib_temp;
fib_temp = fib_num - fib_temp;
}