4 ms·
Is this some common style? int (**hnew()) I've never seen parens used like that. Usually it's: int **hnew()
by viraptor 12y ago
Is this some common style?
int (**hnew())
I've never seen parens used like that. Usually it's:
int **hnew()
- DiabloD3 12y agoMight be to fix some -pedantic issue.
- valleyer 12y agoNo, they are necessary here, otherwise it would return two pointers to pointers to int, not a pointer to pointer to int[2]
- art187 12y agoparens are used since the [2] is on the end. Otherwise, it would think its a pointer to a pointer of an int [2] -> (hnew()[2]).
- deleted 12y ago[deleted]
- deleted 12y ago[deleted]
- userbinator 12y ago[] has higher precedence than *, so without the parens you get "function returning array of two pointer to pointer to int" (which is illegal) instead of the desired "function returning pointer to pointer to array of two int".
- pmelendez 12y agoSo would that be equal to this? typedef int arr2int[2]; typedef arr2int** ptr_arr2int; #define SIZE 1024 static ptr_arr2int hnew() { return calloc(sizeof(int**), SIZE); }