Void print something(). Can we choose another function instead of void here. For example " main". Is void necessary ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Void print something(). Can we choose another function instead of void here. For example " main". Is void necessary ?

1st Dec 2016, 7:08 PM
Black Temple
Black Temple - avatar
3 Answers
+ 1
you are saying that can we replace void main() with main printsomething() it this is the question then the answer is no. Because in the above case void is the function's type and main() is the function's name. However in the latter case main is the type while printsomthing is function's name now. Actually c++ search for the main() function in the program and executes what's inside it, so doing this will fail the compiler on searching the main() function.
1st Dec 2016, 8:48 PM
Mohammed Maaz
Mohammed Maaz - avatar
0
your question is not clear!
1st Dec 2016, 8:38 PM
Mohammed Maaz
Mohammed Maaz - avatar
0
can we replace void with main main printsomething() like this
1st Dec 2016, 8:42 PM
Black Temple
Black Temple - avatar