Interview Question

What is a function prototype?

A prototype declares a function interface before use.

💡 Concept ✅ Quick Revision ⚙ C

Answer

A function prototype is a declaration that specifies a function’s parameter types and return type. • It lets the compiler check argument count and compatible types at a call. • A prototype can appear before the function definition. • In modern C, write `(void)` to declare a function that takes no parameters.

💡 C Example

int square(int value); int main(void) { return square(4) == 16 ? 0 : 1; } int square(int value) { return value * value; }

⚡ Quick Revision

A prototype declares a function interface before use.