Thread: Function ?

  1. #1
    Registered User
    Join Date
    Aug 2003
    Posts
    25

    Question Function ?

    Hey All !

    OK the standard format for defining a function:
    Code:
    typeName functionName(parameterList)
    {
          statements
          return value;   // value is of type typename
    }
    would this also be legal for defining a function?
    Code:
    typeName functionName(int a, int b)
    {
          return (a + b);   /* define the arguments here for use 
                                        let's say by a main function that 
                                        the user input a & b  */
    }
    Last edited by teeyester; 08-22-2003 at 11:01 AM.

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Yes that's fine.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  3. #3
    Registered User
    Join Date
    Aug 2003
    Posts
    25

    Thumbs up

    Thanks Mr Wizard..........

  4. #4
    *******argv[] - hu? darksaidin's Avatar
    Join Date
    Jul 2003
    Posts
    314
    Of course you could have simply compiled the code. I guess the compiler would have complained if it was not valid =)

  5. #5
    Registered User
    Join Date
    Aug 2003
    Posts
    25

    Thumbs up

    darksaidin :
    Touche : Your right...would have learned more that way ........Teeyester

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  2. Seg Fault in Compare Function
    By tytelizgal in forum C Programming
    Replies: 1
    Last Post: 10-25-2008, 03:06 PM
  3. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  4. Replies: 28
    Last Post: 07-16-2006, 11:35 PM
  5. const at the end of a sub routine?
    By Kleid-0 in forum C++ Programming
    Replies: 14
    Last Post: 10-23-2005, 06:44 PM