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

J

julvr

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

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

Ben Pfaff

julvr said:
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.
 
S

sean_in_raleigh

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.

http://en.wikipedia.org/wiki/Significantly_Prettier_and_Easier_C++_Syntax


Sean
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,176
Messages
2,570,947
Members
47,501
Latest member
Ledmyplace

Latest Threads

Top