Jump to 
content
HP.com Home Products and Services Support and Drivers Solutions How to Buy
»  Contact HP

 

dec_c_help.HLP

Interpretation

The symbols used in declarations are C operators, subject to the usual rules of precedence and associativity. These operators are parentheses, brackets, and asterisks for "function returning...", "array of...", and "pointer to...", respectively. Parentheses and brackets associate left to right; asterisk operators associate right to left. Parentheses and brackets have the same precedence, which is higher than that of asterisks. Parentheses are also used to change the associativity of the other operators. The following declaration, for example, is a "function returning a pointer to an array of pointers to char": char * ( *x() ) []; This is how the declaration is broken down to determine what it is: char * ( *x() ) []; * ( *x() ) [] is char ( *x() ) [] is (pointer to) char *x() is (array of) (pointer to) char x() is (pointer to) (array of) (pointer to) char x is (function returning) (pointer to) (array of) (pointer to) char In this sort of breakdown, lower precedence operators are removed first. With two equal precedence operators, remove the rightmost if they are left-to-right operators, and the leftmost if they are right-to-left operators. For example, "[]()" means "array of functions returning...".

Privacy statement Using this site means you accept its terms
© 2007 Hewlett-Packard Development Company, L.P.