Function Prototype Declaration
Function Prototype Declaration is a statement in which programmer describes three information about a function:
- Symbol name of the function
- Return type of the function
- Arguments that will be taken as input
Syntax: <return type> <function name>()<arguments>; Example: int add( int a, int b);
Function Definition
Definition is the actual body/source code of the function. It may contain one or more statements inside it.
Syntax: <return type> <function name>()<arguments> { return ; } Example: int add( int a, int b) { return (a + b); }By default, any C function returns an int value.
add(int a, int b) is same as int add(int a, int b);
If we want the function to return a variable type other than integer, we have to explicitly mention the return type (float or char) before the name of the function during definition and declaration.
A good programming practice is that declaration should be in a header file and definition should be in a source file.
About our authors: Team EQA
You have viewed 1 page out of 248. Your C learning is 0.00% complete. Login to check your learning progress.
Most popular
Questions index C Questions C++ Questions Win32 MFC COM/DCOM DLL Questions
Compilers & Editors
Download Visual Studio Download XCode Download Visual Studio Code Android studio install sdk Eclipse installer Best C compilers IDEs
Development system setup
Windows media creation tool MSDN subscription Ubuntu virtualbox
New updated posts
Why learn C? Calculate weighted average
Questions index C Questions C++ Questions Win32 MFC COM/DCOM DLL Questions
Compilers & Editors
Download Visual Studio Download XCode Download Visual Studio Code Android studio install sdk Eclipse installer Best C compilers IDEs
Development system setup
Windows media creation tool MSDN subscription Ubuntu virtualbox
New updated posts
Why learn C? Calculate weighted average