what is the use of void before the function? | Sololearn: Learn to code for FREE!

+2

what is the use of void before the function?

c

4/16/2021 5:42:16 PM

Gaurav Kumar

10 Answers

New Answer

+5

first you need to understand the basic syntax of a function. data_type function_name() { // return if you need to? } data_type is the return type of the function.. that is when your function returns something then it'll be in this type mentioned. But sometime function does not need to return anything so in that case we use the keyword "void" to indicate the return type. eg: // here we return the sum of a and b // so we have int return type // also you can see keyword "return" inside the function block int sum(int a, int b) { return a+b; } // here we don't want to return anything so void is use and also no return keyword inside the function void print_hello() { printf("hello") ; } More? Please search for the answer before you post your question. https://www.sololearn.com/discuss/475396/?ref=app https://www.sololearn.com/discuss/80098/?ref=app https://www.sololearn.com/discuss/180774/?ref=app https://www.sololearn.com/discuss/1596883/?ref=app

+5

void means the function does not return a value to the caller.

+3

Void is a keyword. It is write before function because it returns nothing.

+1

If your function does not have a return value you use void

+1

It indicates that function is going to return nothing

0

In programming languages like C and C++ void means that the function does not return a value...😎

0

Hariom gupta sir ure a Piece of shî* if u wanna encourage do it ...else keep quiet never discourage any one

0

void before function tells that no value is returning inside this function

-1

Sir you are botttt

-1

Play freefire