Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

why we use function declaration and when we use it And why we don't use in the below example.

+1 vote
asked Sep 2, 2019 by anonymous
main()
{
while(fun());
getch();
}
int fun()
{
static int x=4;
printf("%d",x);
return(--x);
}

1 Answer

0 votes
answered Sep 17, 2019 by Raja Sekhar (260 points)
The function "fun()" return type is int, so function declaration is not necessary.
As by default function returns integer. If a function returns other than integer it should be declared
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...