Thread: a simple question

  1. #1
    Registered User
    Join Date
    Feb 2002

    a simple question

    can you put a function within a function?

    my program goes as follows

    void blah();
    void blah2();

    int main(){
    //[end of program]

    void blah() {

    void blah2() {

    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?

  2. #2
    _B-L-U-E_ Betazep's Avatar
    Join Date
    Aug 2001
    Yes you can... there is something wrong with the semantics of your code then...

    #include <iostream>
    using namespace std;
    void blah2() {cout << "blah";}
    void blah() {blah2();}
    int main()
       return 0;
    Last edited by Betazep; 03-04-2002 at 04:27 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Simple question regarding variables
    By Flakster in forum C++ Programming
    Replies: 10
    Last Post: 05-18-2005, 08:10 PM
  2. Simple class question
    By 99atlantic in forum C++ Programming
    Replies: 6
    Last Post: 04-20-2005, 11:41 PM
  3. Simple question about pausing program
    By Noid in forum C Programming
    Replies: 14
    Last Post: 04-02-2005, 09:46 AM
  4. simple question.
    By InvariantLoop in forum Windows Programming
    Replies: 4
    Last Post: 01-31-2005, 12:15 PM
  5. simple fgets question
    By theweirdo in forum C Programming
    Replies: 7
    Last Post: 01-27-2002, 06:58 PM