C multiple single line declarations

Only x is a pointer to int; y and z are regular ints. This is one aspect of C declaration syntax that trips some people up. C uses the concept of a declarator, which introduces the name of the thing being declared along with additional type information not provided by the type specifier. In the … Read more

Complex C declaration

I haven’t done this in a while! Start with foo and go right. float * (*(*foo())[SIZE][SIZE])() foo is a function with no arguments… Can’t go right since there’s a closing parenthesis. Go left: float * (*(* foo())[SIZE][SIZE])() foo is a function with no arguments returning a pointer Can’t go left further, so let’s cross the … Read more

Complex declarations

Here is a great article about how to read complex declarations in C: http://www.codeproject.com/KB/cpp/complex_declarations.aspx It helped me a lot! Especially – You should read “The right rule” section. Here quote: int * (* (*fp1) (int) ) [10]; This can be interpreted as follows: Start from the variable name ————————– fp1 Nothing to right but ) … Read more