Thread: void

  1. #1
    Registered User
    Join Date
    Oct 2004
    Posts
    2

    void

    wat is teh difference between void before() n void inside ()
    like void add()
    and int function(void)?

  2. #2
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    void add() = a function that has no return and has an unspecified number of parameters.
    int function(void) = a function that has an int return and no parameters.

    p.s. do you own homework

  3. #3
    ---
    Join Date
    May 2004
    Posts
    1,379
    how do you know it is homework?
    it just sounds like a noob question to me
    perfectly ok to ask a question like that i think.

  4. #4
    Registered User
    Join Date
    Jul 2004
    Posts
    101
    >void add() = a function that has no return and has an unspecified number of parameters.
    >int function(void) = a function that has an int return and no parameters.
    It really depends on whether or not the declaration is also a definition. The rules are convoluted because of old style function declarations, but it basically breaks down to this:
    Code:
    void a(); /* Unspecified type and number of arguments */
    void b(void); /* No arguments */
    
    void c()
    {
      /* No arguments */
    }
    
    void d(void)
    {
      /* No arguments */
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  2. Replies: 3
    Last Post: 05-13-2007, 08:55 AM
  3. game window rejected painting !
    By black in forum Windows Programming
    Replies: 4
    Last Post: 03-27-2007, 01:10 AM
  4. msvc just ate one of my source files
    By Eber Kain in forum C++ Programming
    Replies: 6
    Last Post: 07-01-2004, 05:40 AM
  5. Half-life SDK, where are the constants?
    By bennyandthejets in forum Game Programming
    Replies: 29
    Last Post: 08-25-2003, 11:58 AM