Re: Function pointers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


kumar11 wrote:

> Could you please explain the meaning of below declaration statement.
> 
> char (*pa())[4]; 

"pa" is a function returning a pointer to an array of four characters.

C declarations work by declaring an expression involving the
identifier as having a named type (in this case, "char").

"(*pa())[i]" is a character, for 0 <= i < 4.

Therefore:

"(*pa())" is an array of four characters.

Therefore:

"pa()" is a pointer to an array of four characters.

Therefore:

"pa" is a function returning a pointer to an array of four characters.

-- 
Glynn Clements <glynn@xxxxxxxxxxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

Add to Google Powered by Linux