Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • bill190

    bill190

    @bill190-VhqyZT Jul 23, 2010

    Yes. A function is just a collection of programming. And instead of writing all that programming each time you want to use it, you can stick it in a function. Then just use that function name in your program wherever you need to use it.

    So a program to "do your chores"...

    Main Program DoYourChores
    {
    Do ChoresList
    If weekend
    {
    Do ChoresList
    Relax
    }
    }

    Function ChoresList
    {
    Clean yard
    Wash dishes
    Take out trash
    }

    Function Relax
    {
    Watch TV
    }

  • Morningdot Hablu

    Morningdot Hablu

    @morningdot-6Xuj4M Jul 23, 2010

    Realy
    Is it possible ?
    It means a function may be defined within main function ?

  • bill190

    bill190

    @bill190-VhqyZT Jul 23, 2010

    Nested function defines...
    #-Link-Snipped-#

  • arunravindran

    arunravindran

    @arunravindran-qRU1Y4 Aug 1, 2010

    Yes a function can be nested.

  • sushant005

    sushant005

    @sushant005-tyt4WK Aug 2, 2010

    arunravindranYes a function can be nested.

    Is this possible in C programming or JAVA?

  • arunravindran

    arunravindran

    @arunravindran-qRU1Y4 Aug 2, 2010

    Hi,

    Sorry got my concepts wrong...i thought of function calls...a function cannot be defined within a main function as it gives declaration syntax error in C and Java...but nested functions concept exists...Correct me if I am wrong...