C Functions Question:
Download Job Interview Questions and Answers PDF
What is function prototype in C Language?
Answer:
The basic definition of a function is known as function prototype. The signature of the function is same that of a normal function, except instead of containing code, it always ends with semicolon.
When the compiler makes a single pass over each and every file that is compiled. If a function call is encountered by the compiler, which is not yet been defined, the compiler throws an error.
One of the solution for the above is to restructure the program, in which all the functions appear only before they are called in another function.
Another solution is writing the function prototypes at the beginning of the file, which ensures the C compiler to read and process the function definitions, before there is a change of calling the function. If prototypes are declared, it is convenient and comfortable for the developer to write the code of those functions which are just the needed ones.
When the compiler makes a single pass over each and every file that is compiled. If a function call is encountered by the compiler, which is not yet been defined, the compiler throws an error.
One of the solution for the above is to restructure the program, in which all the functions appear only before they are called in another function.
Another solution is writing the function prototypes at the beginning of the file, which ensures the C compiler to read and process the function definitions, before there is a change of calling the function. If prototypes are declared, it is convenient and comfortable for the developer to write the code of those functions which are just the needed ones.
Download C Functions Interview Questions And Answers
PDF
Previous Question | Next Question |
Do you know the difference between exit() and _exit() function in C? | What is the difference between malloc() and calloc() function in C Language? |