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
Post a Comment