C/C++의 Clockwise/Spiral Rule

beechwood·2023년 9월 23일
0

C/C++의 clockwise/spiral rule을 사용하면 int *const 와 const int * 등의 선언을 쉽게 이용할 수 있다.

순서는 다음과 같다.

  1. Start from the name of the variable, move in a spiral/clockwise direction. When encountering the below-mentioned 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. Repeat until all tokens have been covered.
  3. Always resolve anything in parenthesis first!

예시)



Reference

https://aticleworld.com/clockwise-spiral-rule-in-c-cpp-with-examples/

https://coding-chobo.tistory.com/58

0개의 댓글