C++ Call function that is not defined yet -


i have code. how do without creating error?

int function1() {     if (somethingtrue) {         function2();     } }  int function2() {     //do stuff     function1(); } 

just put above functions:

int function1(); int function2(); 

but don't create endless loop! 2 lines tell compiler function1 , function2 defined in future. in bigger projects use header files. there same can use functions in multiple files.

and don't forget return statement. think code example demonstration want mention it.

in c++ must seperate declaration , definition. read more here: https://stackoverflow.com/a/1410632/4175009


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -