+ 6
Doubt in c
int main(void) What does this mean?
24 Respostas
+ 5
Guys I read in one article just now
Void main- the function returns nothing
Void*data - generic data pointer
Main(void)- the function takes nothing
+ 13
P. Aamir *void* inside brackets means that main() will not take any arguments while executing. Just like Dulya Perera said, leaving it empty will have same effect as that of void.
+ 7
Void doing nothing. We can keep it as a blank or with void word.
+ 6
This a function that we could be able to use most of the programming languages to execute the set of tasks.
For ex:-
int addition(int a, int b){
int sum = a + b;
return sum;
}
In here "int" means the data type that you're return. It could be any data type even void. void means nothing.
"main"means function name. That name used call the function.
The things in inside of the brackets are parameters which are needed to full fill the task.
Hope this will help you to eliminate your doubt.
+ 4
Arsenic what will happen if we take parameter in main () function?
+ 4
Samsil Arefeen giving any other argument to main will result in an error.
See this code for reference š
https://code.sololearn.com/c6rcUwuYdQl8/?ref=app
Main() conventionally supports only 2 types of arguments :-
1) void
2) command line arguments (commonly known as *argc* and *argv[ ]* )
Former is generally used to control program from outside instead of hard coding those values inside the code.
You can learn more about command line arguments hereš
https://www.geeksforgeeks.org/command-line-arguments-in-c-cpp/
+ 2
No what does void do inside the bracketDulya Perera
+ 2
Function of it being insideDulya Perera
+ 2
No need to fill void inside since void means nothing or empty
+ 2
Void means nothing for short.
Void main() - means it will not return any value
Similarly
Int main(void)- means it will not take any value as an argument.
Don't bother
int main() and int main(void) both are same
+ 2
int mail(void) means
int->return type of main function
main->name of function, executions of every code start from here
void->means empty which means main function doesn't have any parameter
+ 2
This tells our compiler that our function is null.Void means null.
+ 2
It means our function i.e main doesn't accept any parameter from console
+ 2
Prototype of Main with void param ....
+ 2
It means main does not take anything
+ 1
main in C ALWAYS returns a int.
In parentheses it can takes nothing () or cmdline arguments and optionnaly environment variables
- int main(int argc) useless alone (number of args)
- int main(int argc, char** argv) (+ array of char* -> parameters given on the cmdline)
- int main(int argc, char** argv, char** env) (+ array of char* : the environment variables)
+ 1
int main() or int main(void) are same.
"Empty" Brackets or "void" inside Brackets means that the main function do not accept any arguments/parameters.
0
You can write as :
int main()
OR
int main(void)
Eg: int p() or int p(void)-Both are correct.
void p() or void p(void)-Both are correct.
Here, 'void' means 'nothing here.only void'.
So () means (void). P. Aamir
0
Void is nothing just a function which does not return any value ....while int main returns a value
https://www.sololearn.com/discuss/274359/?ref=app
https://www.sololearn.com/discuss/44133/?ref=app
https://www.sololearn.com/discuss/2044581/?ref=app
0
P. Aamir hope this helps youš