Govt Exams
The static keyword restricts function scope to the file in which it is declared, preventing external linkage.
A base case is essential in recursive functions to provide a termination condition, otherwise the function will recurse infinitely.
int func(int *p) { return *p; }
int main() { int x = 10; printf("%d", func(&x)); }
The function receives a pointer to x, dereferences it with *p, and returns the value 10.
The function simply adds two integers and returns their sum, which is 5 + 3 = 8.
Pre-increment (++x) increments and returns the new value, while post-increment (x++) increments but returns the old value.
The 'inline' keyword (introduced in C99) suggests to the compiler to replace function calls with actual code, reducing call overhead.
Function parameters have function scope, meaning they are accessible throughout the entire function body.
strlen() returns size_t, which is an unsigned integer type used to represent sizes and counts in C.
A function can be called as many times as needed within a program, limited only by memory and stack constraints.
int func(int x) { return x * 2; }
int main() { printf("%d", func(5)); }
func(5) returns 5 * 2 = 10, which is then printed.