17, brackets in expressions

xiaoxiao2021-03-06  85

If you are a more complex expression, you are not very clear, even if you are very clear, please add parentheses, otherwise, others or yourself next time, no Be careful, look at it, understand, in order to avoid this "misunderstanding", and make your own procedure more clear, or plus parentheses.

For example, take the address for a member of a structure:

GetUserage (& (UserInfo-> AGE);

Although, & userinfo-> age, -> The priority of the operator is the highest, add a bracket, it will make people understand what your code means.

For example, a long condition judgment:

IF ((CH [0]> = '0' || CH [0] <= '9') &&

(CH [1]> = 'a' || CH [1] <= 'Z') &&

(CH [2]> = 'a' || CH [2] <= 'Z'))

Brackets, plus spaces and wraps, your code is not easy to read?

转载请注明原文地址:https://www.9cbs.com/read-107732.html

New Post(0)