An Array of Pointers vs. a Multidimensional Array

Discussion in 'all things UNIX' started by lotuseclat79, Oct 31, 2016.

  1. lotuseclat79

    lotuseclat79 Registered Member

    Joined:
    Jun 16, 2005
    Posts:
    5,390
  2. Gullible Jones

    Gullible Jones Registered Member

    Joined:
    May 16, 2013
    Posts:
    1,466
    Hey thanks, that was quite interesting. Though I doubt I'll ever do anything like the 2D array trick in practice. Too clever, not obvious enough in intent.

    Using const on the other hand, yes, very much. Const correctness is good!
     
  3. lotuseclat79

    lotuseclat79 Registered Member

    Joined:
    Jun 16, 2005
    Posts:
    5,390
    Here is about the best pointer related article I have ever found if you are interested in pointers:

    The Ksplice Pointer Challenge

    -- Tom
     
  4. Gullible Jones

    Gullible Jones Registered Member

    Joined:
    May 16, 2013
    Posts:
    1,466
    @lotuseclat79

    Oy, looking at that gives me a headache!

    I'm pretty sure that last one is wrong though. The & operator associates more strongly than +, so that should be taking the base address of x and literally adding 1.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.