Posted in All Posts, Semester 2

Types of Functions in C

There are 4 types of functions defined in C.

  1. Without arguments, without return value.
  2. Without arguments, with a return value.
  3. With arguments, without a return value.
  4. With arguments, with a return value.

#UDF Type 1 – Without Arguments, Without Return
Eg. void main()
Here, the function declaration indicates that the function main() neither returns any value nor accepts any arguments.

Program using UDF Type 1 –


#UDF Type 2 – Without Arguments, With Return
Eg. int add()
Here, the function prototype indicates that the function add() will return an integer type value but doesn’t accept any parameters.

Program using UDF Type 2 –


#UDF Type 3 – With Arguments, Without Return
Eg. void sum(int,int)
The prototype tell us that the function sum() doesn’t return a value but accepts two integer values.

Program using UDF Type 3 –


#UDF Type 4 – With Arguments, With Return
Eg. int mul(int,int)
The above function mul() has a return type int and accepts two integer values.

Program using UDF Type 4 –

We hope that you found this article to be helpful.
Please share your thoughts in the Comments Section.

If you liked this article, then please like our Facebook page.

See what are Recursive Functions.

Suggested Reading

2 thoughts on “Types of Functions in C

Comment your thoughts

This site uses Akismet to reduce spam. Learn how your comment data is processed.