[SOLVED] int *a and int (*a)

Need help with C, C++, perl, python, etc?

[SOLVED] int *a and int (*a)

Postby topaz » 2015-02-26 21:39

Hello everyone,

I could not find a proper answer to my question, so here I am.
Could someone explain me the difference between "int *a" and "int (*a)" in c ?

I now that "int *a" is an array (integer pointer) but then,
what is "int (*a)" ?

If someone could help me, I would be very glad,
Thanks for helping me.
Last edited by topaz on 2015-02-26 22:17, edited 1 time in total.
topaz
 
Posts: 17
Joined: 2014-10-09 12:49

Re: int *a and int (*a)

Postby alansmithee » 2015-02-26 21:49

Those two statements are the same thing, the latter form is just more explicit. The parentheses are unnecessary because they group things using the default grouping rules.

Similar to the way "2 + (3 * 4)" is the same as "2 + 3 * 4".
'alansmithee' is the user formerly known as 'saulgoode'.
User avatar
alansmithee
 
Posts: 41
Joined: 2013-02-02 08:02

Re: int *a and int (*a)

Postby topaz » 2015-02-26 22:16

Thanks for the reply ^^
topaz
 
Posts: 17
Joined: 2014-10-09 12:49


Return to Programming

Who is online

Users browsing this forum: No registered users and 2 guests

fashionable