Why gaming codes look different from lessons here but seem more logical? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why gaming codes look different from lessons here but seem more logical?

int main () void printsomething() {cout <<printsomething;} rather than: void print something () int main () {cout <<printsomething; return 0;} same result less code, since void cancels any return value.

14th Jan 2017, 5:26 PM
Travis Godbold
Travis Godbold - avatar
1 Answer
0
wrong code. In main function you can dont write return 0. compiler do it for you. If you look for difference with this: void printsomethink(){ string printmessage; cout<<printmessage;} int main(){ cout<<printsomethink();} and this: int main(){ string printmessage; cout<< printmessage;} game coders use the first one. because in the function printsomethink you have string message for this function. where function is done, memory is clear. on main, your memory will remember the variables to end of program. sorry for my english
23rd Jan 2017, 5:44 AM
Piotr Koczeń
Piotr Koczeń - avatar