Thread: default values for Struct elements

  1. #1
    Registered User
    Join Date
    Apr 2011

    default values for Struct elements

    Can we set default values for a struct?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    Not in C.

    In C++, you could provide a default constructor.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Sep 2008
    Toronto, Canada
    When defining: struct ... = { value, value, ...}
    Like that? Initialization.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help with project
    By chrisa777 in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2006, 05:01 PM
  2. Replies: 1
    Last Post: 02-03-2005, 03:33 AM
  3. Serial Communications in C
    By ExDigit in forum Windows Programming
    Replies: 7
    Last Post: 01-09-2002, 10:52 AM
  4. Adding Default values to controls in Dialog boxes
    By juhigarg in forum C++ Programming
    Replies: 3
    Last Post: 11-07-2001, 12:44 AM
  5. Default values in function prototypes
    By wdicks in forum C Programming
    Replies: 13
    Last Post: 10-10-2001, 01:06 AM

Tags for this Thread