+ 6

Doubt in c

int main(void) What does this mean?

21st Jul 2020, 9:53 AM
P. Aamir
P. Aamir - avatar
24 Answers
+ 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
21st Jul 2020, 11:41 AM
P. Aamir
P. Aamir - avatar
+ 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.
21st Jul 2020, 10:36 AM
Arsenic
Arsenic - avatar
+ 7
Void doing nothing. We can keep it as a blank or with void word.
21st Jul 2020, 10:34 AM
Dulya Perera
Dulya Perera - avatar
+ 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.
21st Jul 2020, 10:30 AM
Dulya Perera
Dulya Perera - avatar
+ 4
Arsenic what will happen if we take parameter in main () function?
21st Jul 2020, 11:33 AM
The future is now thanks to science
The future is now thanks to science - avatar
+ 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/
21st Jul 2020, 1:07 PM
Arsenic
Arsenic - avatar
+ 2
No what does void do inside the bracketDulya Perera
21st Jul 2020, 10:32 AM
P. Aamir
P. Aamir - avatar
+ 2
Function of it being insideDulya Perera
21st Jul 2020, 10:32 AM
P. Aamir
P. Aamir - avatar
+ 2
No need to fill void inside since void means nothing or empty
21st Jul 2020, 1:10 PM
The CodeGeek
The CodeGeek - avatar
+ 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
21st Jul 2020, 7:21 PM
sushant
sushant - avatar
+ 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
22nd Jul 2020, 2:44 AM
MANSOOR PASHA
MANSOOR PASHA - avatar
+ 2
This tells our compiler that our function is null.Void means null.
22nd Jul 2020, 11:26 AM
Suryansh Tripathi
Suryansh Tripathi - avatar
+ 2
It means our function i.e main doesn't accept any parameter from console
22nd Jul 2020, 1:51 PM
zoufisha khan
+ 2
Prototype of Main with void param ....
23rd Jul 2020, 2:48 AM
Sanjay Kamath
Sanjay Kamath - avatar
+ 2
It means main does not take anything
13th Nov 2020, 9:04 AM
Shivam Mishra
Shivam Mishra - avatar
+ 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)
22nd Jul 2020, 3:30 PM
Bernard Bordja
+ 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.
22nd Jul 2020, 9:38 PM
DEATH128
DEATH128 - avatar
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
21st Jul 2020, 2:55 PM
Amal Babu
Amal Babu - avatar
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
22nd Jul 2020, 3:22 AM
Navneet Kaur💫
Navneet Kaur💫 - avatar
0
P. Aamir hope this helps you😇
22nd Jul 2020, 3:23 AM
Navneet Kaur💫
Navneet Kaur💫 - avatar