Advice

What is the difference between void and int?

What is the difference between void and int?

The void main() indicates that the main() function will not return any value, but the int main() indicates that the main() can return integer type data. When our program is simple, and it is not going to terminate before reaching the last line of the code, or the code is error free, then we can use the void main().

What is the difference between int and void in Java?

void methods do not return anything – they simply perform an action. int methods on the other hand, as the name suggests, return an integer value.

What does int mean in int main void?

int main() indicates that the main function can be called with any number of parameters or without any parameter. On the other hand, int main(void) indicates that the main function will be called without any parameter #include .h> int main() { static int i = 5; if (–i){ printf(“\%d “, i); main(10); } }

READ ALSO:   Can you upgrade the graphics card in a Lenovo ThinkCentre?

What is the purpose of the keyword void?

When used as a function return type, the void keyword specifies that the function doesn’t return a value. When used for a function’s parameter list, void specifies that the function takes no parameters.

What is the difference between void function and int function?

when you use void, it means you don’t want anything returned from the function. while an int return may be a result of calculation in the function, or indicate the status when it returning, such as an error number or something else that can tell you what has happened when the function executing.

What does void mean in int main void?

2 Answers. +1. The first void means that the main function returns no value. The second void in parenthesis (void) means that the main function accepts no arguments. The return type of main is mandated by standards to be of return type int in a hosted environment.

READ ALSO:   Is it good to drink cold drink after eating non veg?

What is difference between return type void and int?

You return void to indicate that nothing is returned. An int return may or may not indicate that calculations have been performed (e.g. could just be a return code). Both have the same behavior and no warning is displayed.