Thread: Embedded functions...

  1. #1
    Registered User dead_cell's Avatar
    Join Date
    Jun 2002
    Posts
    44

    Question Embedded functions...

    I'm constructing a rather large calculator and I need some help with nested (embedded) functions. I've declared some functions before the int main() operator, and I am currently wishing to place embedded functions within those mother functions...

    I'm not being too clear, here's some code:

    Code:
    void one(void)
    {
         void add(void)
         {
         cout<<"blargh, blah blah..."<<endl<<endl;
         }
    }
    Assuming that the code's function one() is being called from a switch case within the int main() function, and the add() is being called from a switch case within the one(), which way should I go about this, having the void blargh(void) inside the mother function one()? Or, should I declare the nested function add() as an int or a float?
    Linux is great - It does infinite loops in five seconds!

    ~Linus Torvalds

  2. #2
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,490
    i don't think that's possible, nested functions. i've never seen a need for them, in any case.

  3. #3
    Registered User dead_cell's Avatar
    Join Date
    Jun 2002
    Posts
    44

    didn't think so

    Yeah, I didn't think so. It'd be alot easier if it were like javascript

    Anyway, thanks. I'll have to revert to the if() statements
    Linux is great - It does infinite loops in five seconds!

    ~Linus Torvalds

  4. #4
    Registered User dead_cell's Avatar
    Join Date
    Jun 2002
    Posts
    44

    Thumbs up

    I tried to keep it neat and a little more efficient than if() statements, but thanks anyway
    Linux is great - It does infinite loops in five seconds!

    ~Linus Torvalds

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Void Functions Help
    By bethanne41 in forum C++ Programming
    Replies: 1
    Last Post: 05-09-2005, 05:30 PM
  2. Functions and Classes - What did I do wrong?
    By redmage in forum C++ Programming
    Replies: 5
    Last Post: 04-11-2005, 11:50 AM
  3. calling functions within functions
    By edd1986 in forum C Programming
    Replies: 3
    Last Post: 03-29-2005, 03:35 AM
  4. Factory Functions HOWTO
    By GuardianDevil in forum Windows Programming
    Replies: 1
    Last Post: 05-01-2004, 01:41 PM
  5. Shell functions on Win XP
    By geek@02 in forum Windows Programming
    Replies: 6
    Last Post: 04-19-2004, 05:39 AM