default value

This is a discussion on default value within the C++ Programming forums, part of the General Programming Boards category; extremely simple question, just wanted to make sure of the answer. What would the code look like of you wanted ...

  1. #1
    Registered User sentienttoaster's Avatar
    Join Date
    Nov 2002
    Posts
    79

    default value

    extremely simple question, just wanted to make sure of the answer. What would the code look like of you wanted to have a function prototype that declared two integers, one of which has a default value of 20?
    This has been a public service announcement from GOD.

    111 1111

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,630
    Code:
    void foo(int a, int b = 20);
    ...
    void foo(int a, int b/*=20*/)
    {
        ...
    }
    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Utilizing another compiled program for a task.
    By kotoroshinoto in forum C Programming
    Replies: 6
    Last Post: 06-03-2008, 01:43 PM
  2. get keyboard and mouse events
    By ratte in forum Linux Programming
    Replies: 10
    Last Post: 11-17-2007, 04:42 PM
  3. A question about constructors...
    By Wolve in forum C++ Programming
    Replies: 9
    Last Post: 05-04-2005, 04:24 PM
  4. Help with default parameter value using ptr-to-functor
    By registering in forum C++ Programming
    Replies: 2
    Last Post: 03-24-2004, 03:21 PM
  5. Switching Default Buttons :: MFC
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 07-02-2002, 04:08 PM

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