If there are too few initializers, the missing elements will be set to 0

This is a discussion on If there are too few initializers, the missing elements will be set to 0 within the C++ Programming forums, part of the General Programming Boards category; Hi What happens if you do use an explicit array size, but it doesn’t agree with the number of initializers? ...

  1. #1
    Registered User
    Join Date
    Mar 2011
    Posts
    254

    If there are too few initializers, the missing elements will be set to 0

    Hi

    What happens if you do use an explicit array size, but it doesn’t agree with the number of initializers? If there are too few initializers, the missing elements will be set to 0. If there are too many, an error is signaled.
    I was wondering what does really happen in case of structure initialization - I mean when there are too few initializers? Are the missing structure members set to some garbage value? Please let me know your informed opinion on this. Thank you.
    I'm an outright beginner. Using Win XP Pro and Code::Blocks. Be nice to me, please.

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Have you tried it?

  3. #3
    Registered User
    Join Date
    Mar 2011
    Posts
    254
    Nope. I'm on using forums on a mobile device. No compiler!
    I'm an outright beginner. Using Win XP Pro and Code::Blocks. Be nice to me, please.

  4. #4
    The larch
    Join Date
    May 2006
    Posts
    3,573
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Missing
    By jturner38 in forum C++ Programming
    Replies: 3
    Last Post: 11-30-2010, 10:34 AM
  2. Something I'm Missing...
    By Dukefrukem in forum C Programming
    Replies: 2
    Last Post: 07-09-2008, 01:47 PM
  3. VS2005 Professional & designated initializers
    By Hansie in forum C Programming
    Replies: 12
    Last Post: 05-25-2007, 12:26 AM
  4. Why are some elements missing after using strcat()
    By monil in forum C Programming
    Replies: 1
    Last Post: 03-08-2005, 10:42 AM
  5. something is missing, and i just cant see it!!
    By Alicia in forum C Programming
    Replies: 2
    Last Post: 01-31-2002, 05:42 PM

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