HI version is available. Content is displayed in original English for accuracy.
Advertisement
Advertisement
⚡ Community Insights
Discussion Sentiment
100% Positive
Analyzed from 409 words in the discussion.
Trending Topics
#int#array#pointers#pointer#char#whatever#rule#function#typedef#type

Discussion (8 Comments)Read Original on HackerNews
It is explained in more detail at this link: https://eigenstate.org/notes/c-decl
Similarly, typedef is also just a keyword in front of a regular declaration.
Now you can use `bar *` as a function pointer.The entire language works like this.
The correct rule is "follow the C grammar". An easier to remember and also correct rule is "start at the identifier being declared; work outwards from that point, reading right until you hit a closing parenthesis, then left until you hit the corresponding open parenthesis, then resume reading right..." (this is sometimes called the "right-left rule": https://cseweb.ucsd.edu/~gbournou/CSE131/rt_lt.rule.html).
Want to write an array of function pointers that return a pointer to an array of pointers to int? Well, that's:
It doesn't make it all that easy to read, but you can at least write the complex types pretty reliably.(The real answer is of course to just typedef every function pointer type or pointer-to-array and not worry about it anymore.)
https://cdecl.org/
Or
on Linux.str is a duck.
Wow, imagine if it was possible to actually use a language like that do declare the type of the variable like that? Something like
or even Just imagine...