51. What is function signature in C?
Function signature consists of the function name and its parameter types. It does not include the return type. The signature helps the compiler differentiate functions in other languages, but in C overloading is not supported.
52. Can a function return multiple values in C?
Directly no. However, multiple values can be returned using pointers, structures, or arrays.
53. What happens if return type does not match returned value?
It leads to undefined behavior or compiler warnings. Proper type matching is necessary.
54. What is implicit return type in old C?
Older C versions assumed int as default return type if not specified. Modern C standards do not allow this.
55. What is void return type?
void indicates that the function does not return any value.
56. What is a pure function?
A pure function does not modify global variables and produces output only based on input parameters.
57. What is reentrant function?
A reentrant function can be safely called again before its previous execution completes. It does not use static/global variables.
58. What is difference between reentrant and recursive?
Recursive means function calls itself. Reentrant means it can safely be interrupted and called again.
59. What is function-like macro?
Macro that behaves like a function but is expanded during preprocessing.
60. Difference between macro and function?
Macros are expanded before compilation and do not perform type checking. Functions are compiled and type-safe.
61. Can function pointer point to different functions?
Yes, if the function signatures match.
62. What is typedef for function pointer?
typedef simplifies complex function pointer declarations.
63. Can function pointer be NULL?
Yes, but calling a NULL function pointer causes runtime crash.
64. How are function pointers used in sorting?
Functions like qsort() accept comparator function pointers.
65. What is dispatch table?
An array of function pointers used to select functions dynamically.
66. What is callback mechanism?
A function passed to another function to be executed later.
67. Can function pointer be passed as parameter?
Yes, it enables flexible and modular design.
68. Can function pointer return void?
Yes, if it points to function returning void.
69. What is pointer to pointer to function?
It is a pointer that stores address of function pointer.
70. What is complexity of function pointer syntax?
Function pointer syntax is complex due to precedence rules and parentheses.
71. What happens to local variables after function exits?
They are destroyed and memory is freed from stack.
72. Where are function parameters stored?
In stack memory.
73. What is stack frame?
Stack frame contains function parameters, local variables, and return address.
74. What is recursion stack?
Each recursive call creates separate stack frame.
75. What is static function?
static function is limited to the file in which it is declared.
76. What is function visibility?
Visibility determines where function can be accessed.
77. What is inline vs normal function?
Inline reduces function call overhead but increases code size.
78. What is function call overhead?
Overhead includes stack setup, parameter passing, and return handling.
79. What is tail call optimization?
Compiler optimizes tail recursion to reduce stack usage.
80. What is undefined behavior in functions?
Occurs due to incorrect return, invalid pointer, or memory misuse.
81. What is segmentation fault?
Occurs when accessing invalid memory through pointer.
82. What causes infinite recursion?
Missing or incorrect base condition.
83. What is function prototype mismatch?
When declaration and definition differ.
84. How to debug function pointer issues?
Check correct signature and ensure pointer is initialized.
85. What is assert in functions?
Used for debugging to test assumptions.
86. What is stack overflow error?
Occurs when stack memory exceeds its limit.
87. What is memory leak in functions?
Occurs when dynamically allocated memory is not freed.
88. What is dangling pointer?
Pointer referencing freed memory.
89. What is wild pointer?
Uninitialized pointer.
90. What is function side effect?
Modification of global variable or external state.
91. Can a function return pointer?
Yes, but must not return pointer to local variable.
92. What happens if we return local variable address?
Leads to undefined behavior.
93. What is higher-order function?
Function that accepts or returns function pointer.
94. What is modular programming?
Dividing program into smaller functions.
95. What is cohesive function?
Function performing one specific task.
96. What is coupling in functions?
Dependency between functions.
97. What is header file role in functions?
Stores function declarations for reuse.
98. Why avoid global variables?
They reduce modularity and increase bugs.
99. How to improve function performance?
Use inline, avoid recursion if possible, optimize logic.
100. What are best practices for functions in C?
Use meaningful names, proper prototypes, limit scope, avoid globals, handle errors, and write modular code.
📢 Join Our WhatsApp Channel
💼 Get Daily IT Job Updates, Interview Preparation Tips & Instant Alerts directly on WhatsApp.
👉 Join WhatsApp Now📢 Join Our Telegram Channel
💼 Get Daily IT Job Updates, Interview Tips & Exclusive Alerts directly on Telegram!
👉 Join Telegram