Functions has been categorized into 4 different types on the basis of return types and arguments. Those types are as follows:

  1. with no return value and no argument
  2. with no return value but with argument
  3. with return value but no argument
  4. with both return value and argument

1. with no return value and no argument

This type of function does not have any arguments and have a void return type.

Program of function with no return value and no argument

#include<stdio.h>

void sum()
{
    int a = 10, b = 20;
    printf("Sum of a and b is = %d\n", a+b);
}

int main()
{
    sum();
    return 0;
}

output

Sum of a and b is = 30

2. with no return value but with argument

This type of functions contains arguments but have void return type.

Program of function with no return value but with argument

#include<stdio.h>

void sum(int x, int y)
{
    printf("sum of a and b is = %d\n", x +y);
}

int main()
{
    int a = 10, b = 20;
    sum(a, b);
    return 0;
}

output

sum of a and b is = 30

3. with return value but no argument

This type of function have return type but does not have any arguments.

Program of function with return value but no argument

#include<stdio.h>

int sum()
{
    int a = 10, b = 20;
    return a+b;
}
int main()
{
    printf("sum of a and b is %d\n", sum());
    return 0;
}

Output

sum of a and b is 30

4. with return value and with argument

This type of functions have both return type and arguments.

Program of function with both return value and argument

#include<stdio.h>

int sum(int x, int y)
{
    
    return x+y;
}
int main()
{
    int a = 10, b = 20;
    printf("sum of a and b is %d\n", sum());
    return 0;
}

Output

sum of a and b is 30