- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is function prototype in C language
A function is a self-contained block that carries out a specific well-defined task.
Types of functions
Functions are broadly classified into two types which are as follows −
- Predefined functions
- User defined functions
Communications among functions
Functions communicate among themselves by using arguments and return value.
Farm of ‘C’ function for return-datatype function name (argument list) is as follows −
{ local variable declarations; executable statements(s); return (expression); }
For Example, void mul (int x, int y).
{ int p; p=x*y; printf(“product = %d”,p); }
Prototype functions
These functions can be done in two ways as explained below −
Create a copy of the function declaration with the arguments typed, with or without identifiers for each.
For example,
int func(int, float, unsigned [2]); int func(int i, float f, unsigned u[2]);
We can also prototype a function by writing the function definition in prototype form.
For example,
int func(int i, float f, unsigned u[2]){ < code for func > }
Use of function prototype
A prototyped function which is called with one or more arguments of incompatible type.
When the explicit or implicit declarations for the same function are encountered. This version of the compiler scrutinizes the duplicate declarations carefully and catches inconsistencies.
- Related Articles
- What is the purpose of a function prototype in C/C++?
- Importance of function prototype in C
- What is strlen function in C language?
- What is strcoll() Function in C language?
- What is strspn() Function in C language?
- What is strcpy() Function in C language?
- What is strcat() Function in C language?
- What is strncat() Function in C language?
- What is strcmp() Function in C language?
- What is strncmp() Function in C language?
- What is strstr() Function in C language?
- What is strncpy() Function in C language?
- What is strrev() Function in C language?
- What is exit() function in C language?
- What is strtok() function in C language?
