Question

Give example of a void type and a double type function. Also show how they work.

Give example of a void type and a double type function. Also show how they work.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Please upvote if you are able to understand this and if there is any query do mention it in the comment section.

Example of void type function:

CODE:

#include <stdio.h>

void func(int n) {//creating a void type function with a parameter
printf("%d", n);
}

int main()
{
func(2);//calling the void type fuction

return 0;
}

9 #include <stdio.h> 10 11 - void func(int n) {//creating a void type function with a parameter 12 printf(%d, n); 13 } 14 1

OUTPUT:

2 ... Program finished with exit code 0 Press ENTER to exit console. I

Void type function: void type function is created with void returntype and does not return anything.

Example of double type function:

CODE:

#include <stdio.h>

double func(double n) {//creating a double type function with a parameter
printf("%f", n);
return n;
}

int main()
{
func(2.2);//calling the double type fuction

return 0;
}

9 #include <stdio.h> 10 11 double func(double n) {//creating a double type function with a parameter 12 printf(%f, n); 13 r

OUTPUT:

2.200000 ... Program finished with exit code 0 Press ENTER to exit console..

Double type function: double type function is created with void returntype and always returns a value.

If anything else is required in this or this was supposed to be done in any other way then please mention in the comment section otherwise please upvote.

Add a comment
Know the answer?
Add Answer to:
Give example of a void type and a double type function. Also show how they work.
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT