The “right-left“ rule

微生永春
2023-12-01

The “right-left” rule is a completely regular rule for deciphering C
declarations. It can also be useful in creating them.

“左右”规则是解密C的完全规则声明。在创建它们时也很有用.

First, symbols. Read

  • as “pointer to” - always on the left side
    [] as “array of” - always on the right side
    () as “function returning” - always on the right side

*作为“指向”的指针-始终在左侧
[]作为“数组”-始终在右侧
()作为“函数返回”-始终在右侧

as you encounter them in the declaration.

当你开始使用这个规则时

STEP 1

Find the identifier. This is your starting point. Then say to yourself,
“identifier is.” You’ve started your declaration.

查找标识符。这是你的起点。然后对自己说“标识符是”

STEP 2

Look at the symbols on the right of the identifier. If, say, you find “()”

 类似资料: