function inside

#include<iostream>
using namespace std;
void f1(){
cout<<"entered into f1";
void f2(){cout<<"entered f2";}
}

int main(){f1();
system("pause");
return 0;
}
// if we define one function inside another function as above we are getting error .why is this happening.

Neither C nor C++ allow you to define functions within other functions.
f2 needs to be moved outside of f1.

Topic archived. No new replies allowed.