Thread: array issue

  1. #1
    Registered User
    Join Date
    Jun 2003
    Posts
    147

    array issue

    I'm still confused about this basic question, is there a difference in array declaration b etween C and C++?

    wat i'm specifically referring to is the number u put within the squared brackets, like array[10] in C but in C++ could be array[9] instead...
    Only by the cross are you saved...

  2. #2
    eh ya hoser, got a beer? stumon's Avatar
    Join Date
    Feb 2003
    Posts
    323
    That number is just how many elements you want the array to have. It is the same in C and C++.
    Blah[10] will create a 10 element array named "blah" in both C and C++.
    The keyboard is the standard device used to cause computer errors!

  3. #3
    Registered User
    Join Date
    Jun 2003
    Posts
    147
    but does this size declaration, for example, array[10] include the NULL element? also, it means that when assigning values, it would be from array[0] to array[9] rite?
    Only by the cross are you saved...

  4. #4
    Been here, done that.
    Join Date
    May 2003
    Posts
    1,164
    Originally posted by fkheng
    but does this size declaration, for example, array[10] include the NULL element? also, it means that when assigning values, it would be from array[0] to array[9] rite?
    Yes, if you need a NULL element in your array, it must be in one of the 10 locations defined.
    Definition: Politics -- Latin, from
    poly meaning many and
    tics meaning blood sucking parasites
    -- Tom Smothers

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. help with small program. array issue
    By InvariantLoop in forum C++ Programming
    Replies: 2
    Last Post: 04-09-2004, 12:26 PM
  2. C Filling and Printing a 2-d array
    By Smoot in forum C Programming
    Replies: 3
    Last Post: 11-13-2003, 08:42 PM
  3. Merge sort please
    By vasanth in forum C Programming
    Replies: 2
    Last Post: 11-09-2003, 12:09 PM
  4. Creating 2D arrays on heap
    By sundeeptuteja in forum C++ Programming
    Replies: 6
    Last Post: 08-16-2002, 11:44 AM
  5. Hi, could someone help me with arrays?
    By goodn in forum C Programming
    Replies: 20
    Last Post: 10-18-2001, 09:48 AM