Results 1 to 3 of 3

Thread: Declaring Arrays

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    In my class we didn't get to cover this and it was the next thing we were going to do! So how do I declare and use arrays?

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Two ways:
    Code:
    int MyArray[10];
    
    // I can go from MyArray[0] to MyArray[9]
    // An access violation exception will occur if you try to
    // use MyArray[10];
    or

    Code:
    int* MyArray;
    int MyNum = 50;
    
    MyArray = new int[MyNum + 3];
    The second way, you can use variable names and anything else to make the array size.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    cool, thanks parksie

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width