C Reference Manual Appendix A - Meaning of declarators -


while reading through c reference manual, appendix a, found following statement

in declaration t d d has form ( d1 ), type of identifier in d1 same of d. parenthesis not alter type may change binding in complex declarators.

how can declarator take form of ( d1 ) , difference in binding being referred here.

eg: int a proper declaration int (a) mean?

int (a) means same int a. not "complex declarator".

an example make difference when declaring function pointer:

int (*f)(float); 

this means "f pointer function takes float , returns int". without parentheses, read:

int *f(float); 

this means "f function takes float , returns int* (pointer int)". quite different indeed.

try website cdecl.org (or command line tool cdecl) explain these:

cdecl> explain int (*f)(float); declare f pointer function (float) returning int cdecl> explain int *f(float); declare f function (float) returning pointer int 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -