Which of the following are void functions?

main
pow
sqrt
All of the above

The correct answer is D. All of the above.

A void function is a function that does not return a value. The main function is a special function that is called when the program starts. The pow function returns the power of a number to another number. The sqrt function returns the square root of a number.

Here is an example of a void function:

void printHello() {
printf("Hello, world!\n");
}

This function does not return a value. It simply prints the message “Hello, world!” to the screen.

Here is an example of a function that returns a value:

int add(int a, int b) {
return a + b;
}

This function returns the sum of the two numbers a and b.

The main function is a special function that is called when the program starts. It is the first function to be executed. The main function must have the following prototype:

int main() {
// code goes here
return 0;
}

The pow function returns the power of a number to another number. The prototype of the pow function is:

double pow(double x, double y) {
// code goes here
}

The sqrt function returns the square root of a number. The prototype of the sqrt function is:

double sqrt(double x) {
// code goes here
}

Exit mobile version