What is the difference between them?

Q

quarkLore

Dik said:
int **a[10];

declare a as array 10 of pointer to pointer to int
int *(*a)[10];

declare a as array 10 of pointer to pointer to int
int (*a[10])();

declare a as array 10 of pointer to function returning int

cdecl is your friend.

cdecl is indeed a great tool. It is discussed in K&R. The man page for
it is really kewl as it contains examples, grammar etc.

But I was wondering if there is a systematic method to do it yourself.
I mean a step by step human understandable approach
 
R

Robert Gamble

Dik said:
declare a as array 10 of pointer to pointer to int
int *(*a)[10];
declare a as array 10 of pointer to pointer to int
int (*a[10])();
declare a as array 10 of pointer to function returning int
cdecl is your friend.

cdecl is indeed a great tool. It is discussed in K&R. The man page for
it is really kewl as it contains examples, grammar etc.

But I was wondering if there is a systematic method to do it yourself.
I mean a step by step human understandable approach

Yes, see http://www.ericgiguere.com/articles/reading-c-
declarations.html.

Robert Gamble
 
G

guoliang

good answer!

Robert Gamble said:
Dik said:
int **a[10];
declare a as array 10 of pointer to pointer to int
int *(*a)[10];
declare a as array 10 of pointer to pointer to int
int (*a[10])();
declare a as array 10 of pointer to function returning int
cdecl is your friend.

cdecl is indeed a great tool. It is discussed in K&R. The man page for
it is really kewl as it contains examples, grammar etc.

But I was wondering if there is a systematic method to do it yourself.
I mean a step by step human understandable approach

Yes, see http://www.ericgiguere.com/articles/reading-c-
declarations.html.

Robert Gamble
 
C

CBFalconer

guoliang said:
good answer!

Terrible answer. It was top-posted, losing all connection with the
actual problem. Your answer belongs after the material to which
you reply, after snipping anything immaterial.

--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>

"A man who is right every time is not likely to do very much."
-- Francis Crick, co-discover of DNA
"There is nothing more amazing than stupidity in action."
-- Thomas Matthews
 
K

Kenny McCormack

Terrible answer. It was top-posted, losing all connection with the
actual problem. Your answer belongs after the material to which
you reply, after snipping anything immaterial.

Get a life!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top