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


what is the use of void before the function?


4/16/2021 5:42:16 PM

Gaurav Kumar

10 Answers

New Answer


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


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


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


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


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


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


Sir you are botttt


Play freefire