# C : How to read that definition ....



## DonJoky (Mar 18, 2013)

Hello all,

I'd like to ask you to help me to understand this definition in "C"

```
int (*f (float (*) (long), char *)) (double);
```
How can I read this definition?
How can I call this function? 

It's example from C programming, a modern approach (K.N.King)

Thank you very much.
Have a nice day.
Best regards,

Jozef


----------



## DutchDaemon (Mar 18, 2013)

Why not just ask at a programming or C forum? Are you using FreeBSD?


----------



## DonJoky (Mar 18, 2013)

Hello @DutchDaemon,

Yes, I'm using FreeBSD 9.1-RELEASE. I'm studying the C language. I thought, I can put that question here, sorry.

Jozef


----------



## DutchDaemon (Mar 18, 2013)

You can, but this is not really a forum where a lot of programmers hang out and share their experiences. So a dedicated programming forum might work better/faster.


----------



## wblock@ (Mar 18, 2013)

DonJoky said:
			
		

> It's example from C programming, a modern approach (K.N.King)



What page?


----------



## DonJoky (Mar 18, 2013)

Chapter 18, page 481, Excercise 12


----------



## tmw (Mar 18, 2013)

Hello,

signal(3)

The signal function might give you some clue how to interpret your function


----------



## throAU (Mar 19, 2013)

The way to read that is to find out who wrote the code, and get them to fix it or be shot.


----------



## DonJoky (Mar 19, 2013)

Hi all,

Yesterday I found a great article about that issue.
c-faq.com/decl/spiral.anderson.html
Now I understand it, it's clear and easy 
Thank you to all.
Have a nice day.

Jozef


----------



## expl (Mar 19, 2013)

Function pointers are quite ugly. I'd recommend not to use definitions like this directly in your code, instead wrap them in typedefs and put a comment above for yourself/others, describing the function it points to.


----------



## fluca1978 (Mar 21, 2013)

DonJoky said:
			
		

> ```
> int (*f ([color="Red"]float (*) (long)[/color], char *)) (double);
> ```



Ok, but was the above correct?


----------



## tmw (Mar 21, 2013)

It is.
Keep in mind that this is a prototype.


----------



## expl (Mar 21, 2013)

fluca1978 said:
			
		

> Ok, but was the above correct?



The red part means argument that is a pointer to a function that returns float and takes a single long.


----------

