Category of functions

There are four main categories of the functions these are as follows:

1.      Function with no arguments and no return values.

2.      Function with no arguments and a return value.

3.      Function with arguments and no return values.

4.      Function with arguments and return values.

 1.      Function with no arguments and no return values: This type of functions has no arguments and no return type. The example is as follows:

void sum()

{

———–

———–

}

2.      Function with no arguments and a return value: This type of functions has no arguments but a return value. The example is as follows:

int sum()

{

——–

——–

return (value);

}

3.      Function with arguments and no return values: This type of functions has arguments but no return value. The example is as follows:

void sum(int a,int b)

{

—————-

—————-

}

4.      Function with arguments and return values: This type of functions has arguments and also has a return value. The example is as follows:

float sum(int a, float b)

{

———-

———-

}

Posted in C

Leave a Reply

Your email address will not be published. Required fields are marked *