Understanding C/C++ style declarations!!!
There are certain rules known as Clockwise/Spiral rules to understand C/C++ style declarations.
It follows 3 simple rules:( see example below for better understanding).
- Starting with the unknown element, move in a spiral/clockwise direction; when encountering the following elements replace them with the corresponding English statements:
- [X] or []=> Array X size of… or Array undefined size of…
- (type1, type2)=> function passing type1 and type2 returning…
- *=> pointer(s) to...
2. Keep doing this in a spiral/clockwise direction until all tokens have been covered. 3. Always resolve anything in parenthesis first.