Entrance Exams
Govt. Exams
Static variables inside a function have local scope but static storage duration, meaning they retain their value between function calls and are initialized only once.
The C standard does not impose a maximum limit on the number of function parameters, though practical implementations may have compiler-specific limits.
This is call-by-value. The function swaps copies of x and y, not the originals. Original values remain unchanged.
inline is a hint to compiler to expand function at call site. It's supported in C99+ and compiler decides whether to inline or not.
Variadic functions accept variable number of arguments using ellipsis (...) and accessed with va_list, va_arg macros.
This is call by reference using pointers. The function receives address of x, dereferences and modifies it to 20.
extern allows you to declare a function defined elsewhere, enabling its use across multiple translation units.
Arrays in C decay to pointers to their first element, effectively making them pass-by-reference. Changes inside function affect original array.
This calculates factorial. fact(5) = 5*4*3*2*1 = 120. Base case n<=1 stops recursion.
Default parameters are a C++ feature, not available in standard C. C requires explicit arguments for all parameters.