Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: 2_D Arrays

  1. #1
    New to the CF scene
    Join Date
    Oct 2002
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    2_D Arrays

    Hello,

    My query regards 2 D arrays. As we know a 1 D array ( say int k[7]; ) k points to the zeroth oth or the first element of the array.

    When it comes to a 2 D array ( int k[7] [3] )..what is the exact role of k here? Need to complete my university assignment,,,any help would be great..

  • #2
    New Coder
    Join Date
    Jun 2002
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If you have a multidimensional array (k) it is actually an array of arrays. (k) points to the address of the first element of the entire array (&k[0]). Since (k[0]) is itself an array, it points to the address of the first element contained inside it (&k[0][0]). Since both point to the same location it can be said that (k) and (k[0]) have the same value.

    So k merely points to the first array, inside the array.


  •  

    Posting Permissions

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