Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting tired with pointers to functions.HELP!!

Status
Not open for further replies.

anvartk

Programmer
Dec 19, 2000
7
IN
What do the following statements indicate?
1)
int(*p)[10]
int*p[10]

2)How can i understand what
the following statement indicates?

char *(*(*a[N])())();
 
A few things to help you with these:

1) Start from the inside of the expression and work your way out.

2) Understand how pointers to functions are declared.

3) Understand operator precedence.

4) Keep in mind that the parentheses are there to override operator precedence.

5) If all else fails, use cdecl :)

I'm getting the feeling that you're posting homework questions here, so I don't want to give the answers to the specific questions you listed. Hopefully the steps above will get your started and if you get stuck, post again.

Russ
bobbitts@hotmail.com
 
Hi,
Don't misunderstand me
The questions above are from
a test i attended.
I did'nt get the answer
Please help me(Give me answers)



 
1)
int(*p)[10] () -> 10 function pointers
int* p[10] -> 10 integer pointer array

2 char * ( *(*a[N])() )() -> A function which return a char pointer
*(*a[N])() -> A function which return a function pointer
*a[N] -> A function pointer's pointer array

So you can understand it in sequence below:
1. Get the Nth element from a which is a pointer to a pointer of a function <- a[N]
2. Get the function's pointer <- *a[N]
3. Call the function which return a function pointer
<- *(*a[N])()
4. Call the return function which return a char pointer
<- char * (*(*a[N])())()

But i donnot programming in such a way it is difficult to understand ^_^
&quot;Simple is good&quot;
Hope this helps you! I want to migrate to Canada or Australia. Any relative information you supplied will be appreciated!

zallen@cmmail.com
ICQ:101229409
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top