void inside ()

This is a discussion on void inside () within the C++ Programming forums, part of the General Programming Boards category; Whats the difference between function(void); and function();?...

  1. #1
    Back after 2 years Panopticon's Avatar
    Join Date
    Dec 2002
    Posts
    262

    void inside ()

    Whats the difference between function(void); and function();?
    I AM WINNER!!!1!111oneoneomne

  2. #2
    Registered User
    Join Date
    Dec 2002
    Posts
    103

    There is a difference between C / C++

    void fun() is treated as
    void fun(...) in C.

    Here ... stands for ellipse, which means variable list of arguments


    void fun() is treated as
    void fun(void) in C++.

    This means there is no real difference between void fun() and void fun(void) in C++.
    Last edited by shiv_tech_quest; 01-13-2003 at 03:30 AM.
    Have a wonderful day.... and keep smiling... you look terrific that way
    signing off...
    shiv... as i know him

  3. #3
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    when you use function(void) your compiler automatically assumes that its arguments are "void". Not sure about C but its definately like that for C++.

  4. #4
    Registered User
    Join Date
    Dec 2002
    Posts
    119
    As far as I know, in C++, int func(void); and int func();
    are exactly the same. Explicitly stating void just makes your intentions clear that the function takes no arguments.

    -Futura
    If you speak or are learning Spanish, check out this Spanish and English Dictionary, it is a handy online resource.
    What happens is not as important as how you react to what happens. -Thaddeus Golas

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 04:25 PM
  2. saying hello and 1st question
    By darksys in forum C Programming
    Replies: 12
    Last Post: 10-31-2008, 03:58 PM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 03:39 PM
  4. msvc just ate one of my source files
    By Eber Kain in forum C++ Programming
    Replies: 6
    Last Post: 07-01-2004, 06:40 AM
  5. Just one Question?
    By Irish-Slasher in forum C++ Programming
    Replies: 6
    Last Post: 02-12-2002, 10:19 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21