1

Possible Duplicate:
C void arguments

I am looking at some OpenGL graphics code and it has the following:

glutIdleFunc(void(*func)(void));

When does it mean to have a function pointer with a void argument in C? Does this mean the function can take in any arguments or is not allow to take in any arguments, or something else?

Community
  • 1
  • 1
ZenBalance
  • 10,087
  • 14
  • 44
  • 44
  • 3
    It means that the function takes no arguments. See [this answer](http://stackoverflow.com/a/693794/275567). – pb2q Sep 30 '12 at 20:14
  • It's a function pointer to a function that takes no arguments and returns nothing. Note that the function pointer may be casted and this may be only a place holder for arbitrary function pointers to be passed to the function `glutIdleFunc` – stefan Sep 30 '12 at 20:21

2 Answers2

3

It means you have to pass a pointer to a function that has no parameters and returns nothing.

Eric Postpischil
  • 195,579
  • 13
  • 168
  • 312
ouah
  • 142,963
  • 15
  • 272
  • 331
0

void func(void) is a function that takes no parameters and does not return anything.

This is not to be confused with: void func() which in C (not C++) is a function that has no parameter checking, and does not return anything.

This is not to be confused with: func(void) which is a function which takes no parameters and returns an int, by default.

cdarke
  • 42,728
  • 8
  • 80
  • 84