int (*varname)[4][4]; ???

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • julvr

    int (*varname)[4][4]; ???

    What exactly does the following do (and what memory does it allocate?)

    int (*varname)[4][4];
  • Ben Pfaff

    #2
    Re: int (*varname)[4][4]; ???

    julvr <nospam@ulvr.co mwrites:
    What exactly does the following do (and what memory does it allocate?)
    >
    int (*varname)[4][4];
    It declares varname as a pointer to an 4-element array of
    4-element arrays of ints.
    --
    "I've given vodka years and years of oral pleasure, and it's done the
    same for me. And neither of us has really taken any steps to take the
    relationship to the `next level.'"
    --Jeremy Hunt

    Comment

    • sean_in_raleigh@yahoo.com

      #3
      Re: int (*varname)[4][4]; ???

      On Mar 13, 4:18 pm, julvr <nos...@ulvr.co mwrote:
      What exactly does the following do (and what memory does it allocate?)
      >
      int (*varname)[4][4];
      C++'s declaration syntax (inherited from C) is
      indeed a nightmare. You should definitely read
      Chapter 3 of Peter van der Linden's "Expert C
      Programming", a wonderful and hilarious book which
      gives a nice decoder ring for making sense
      of these things (the one you mentioned isn't
      anywhere near as bad as it gets when pointers
      to functions get involved).

      Also, check out SPECS, which is a syntax-change-only
      reskinning of C++ (with an amusing nod to C++'s original
      name). I'm not suggesting you program in it, but
      it's nice to realize that the declaration syntax
      is historical cruft from a failed experiment, not
      something inherently unsound about the language.




      Sean

      Comment

      Working...