-
a simple question
can you put a function within a function?
my program goes as follows
//...
void blah();
void blah2();
int main(){
//[program]
blah()
//[end of program]
}
void blah() {
//[function]
blah2();
}
void blah2() {
//[function]
}
where blah and blah2 are functions. what happens is, the program runs, blah runs, but then blah2 never runs. the program compiles just fine, and i dont encounter any errors within the program itself.
any ideas?
-
Yes you can... there is something wrong with the semantics of your code then...
Code:
#include <iostream>
using namespace std;
void blah2() {cout << "blah";}
void blah() {blah2();}
int main()
{
blah();
return 0;
}