Function Prototype

Function prototypes are conventionally placed at the beginning of a program (i.e., before the main () function) and are used to inform the compiler of the name, data type, and number and data types of the arguments, of all user – defined function employed in the program. The general form of a function prototype is

data – type    function – name (type 2, …., type n);

where data – type represents the data type of the item returned by the referenced function, name is the name of the function, and type 1, type 2,…., type n are the data types of the arguments of the function. Note that it is not necessary to specify the names of the arguments in a function prototype. Incidentally, the function prototypes for predefined library functions are contained within the associated header files which must be included at the beginning of every program which uses these functions. The functions prototype for the above functions are:

float process (float);
int sum_ digit (int);

Example – Addition of three numbers without returning any value.

void addition (float x, float y, float z) 
{
    float s;
    s = x+ y+ z;
    printf (“sum = %f”, s);
}


About the Author



Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.

We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc





 PreviousNext