Govt. Exams
Entrance Exams
C passes parameters by value by default. To achieve pass-by-reference effect, pointers must be used explicitly.
int factorial(int n) { return n * factorial(n-1); }
The recursive function lacks a base case (like if n==0 return 1) to terminate recursion, causing infinite recursion and stack overflow.
A recursive function is one that calls itself. It must have a base case to avoid infinite recursion.
int calculate(int a, float b, char c);
All three parameters must be provided in correct order and compatible types.
If a function with a non-void return type lacks a return statement, it returns undefined/garbage value. For void functions, no return is needed.
Declaration (prototype) tells the compiler about the function signature; definition provides the actual function body and implementation.
In older C standards (before C99), if no return type is specified, the default is 'int'. However, this is deprecated in modern C standards.