Right-left rule

information

Hello everyone,

I would like to share with you all the right-left rule. (Or the Clockwise/Spiral rule).
Copyright goes to their respective owners, Jack Purdum and David Anderson.

There is a simple rule to understand non-trivial declaration in C / C++, such as the following:
char *ps[3][4]; //  ps is an array of 3 arrays of 4 pointers to characters

 

:Since I don’t want to create a huge post, I will share some links that are explaining it in detail:
http://jdurrett.ba.ttu.edu/3345/handouts/RL-rule.html
http://c-faq.com/decl/spiral.anderson.html

 

For the lazy ones that want only the result, you can use the following website:

http://cdecl.org/
(Although I strongly suggest to read and understand it at first).

Leave a comment

Your email address will not be published.