Reading C type declarations(引用http://unixwiz.net/techtips/reading-cdecl.html)
Even relatively new C programmers have no trouble reading simple C declarations such as
int foo[5]; // foo is an array of 5 ints
char *foo; // foo is a pointer to char
double foo(); // foo is a function returning a double
but as the declarations get a bit more involved, it's more difficult to know exactly what you're looking at.
char *(*(**foo[][8])())[]; // huh ?????
It turns out that the rules for reading an arbitrarily-complex C variable declaration are easily learned by even beginning programmers (though how to actually use the variable so declared may be well out of reach).
This Tech Tip shows how to do it.
我們經常會遇到復雜的C聲明,對于如何閱讀這些聲明,這里記錄了一篇外文,寫的很好,值得閱讀。
http://unixwiz.net/techtips/reading-cdecl.html
浙公網安備 33010602011771號