Determining Complex Variable Names in C Language

This is a method taught by one of my instructors during training, which I find very useful and would like to share.“Prioritize parentheses, evaluate from right to left, and from near to far”Prioritize parentheses: Variables are combined with the operator closest to the parentheses first.Evaluate from right to left: Variables first combine with the operator to the right.From near to far: Variables combine with operators in order from near to far.Determining Complex Variable Names in C LanguageAll the variable names above are determined according to the above rules. When encountering complex naming rules in C language, you can also use these rules to understand the names. Knowing the names has many benefits, such as aiding in problem searches and understanding whether a variable is a pointer, function, or array. If you cannot determine what ‘a’ is, you cannot proceed to the next step.For example, if ‘a’ is originally a function, but you mistakenly determine ‘a’ to be a pointer, this could lead to errors in calling ‘a’ and potentially cause bugs. It is crucial to pay special attention to whether we are using a pointer or a function.

Leave a Comment