-3
int (*is_space)(unsigned char);
int (*is_term)(unsigned char);
size_t blk_size;
void *(*malloc_func)(size_t);
void *(*realloc_func)(void *, size_t);

I am not very clear about what these types and declarations refer to.

Can anyone help me?

Regexident
  • 29,441
  • 10
  • 93
  • 100
user1279988
  • 757
  • 1
  • 11
  • 27
  • 5
    google "function pointer" – Doug T. Feb 01 '13 at 15:28
  • 1
    possible duplicate of [What does "void (\* parse\_arg\_function)(const char\*)" function argument mean in C?](http://stackoverflow.com/questions/2574906/what-does-void-parse-arg-functionconst-char-function-argument-mean-in-c) – John Dvorak Feb 01 '13 at 15:30
  • 2
    [How do you read C declarations?](http://stackoverflow.com/questions/89056/how-do-you-read-c-declarations) – LihO Feb 01 '13 at 15:30

2 Answers2

2

These are function pointers.

For example, is_space is a pointer to a type of function which takes unsigned char as parameter and returns an int

These are useful to define callback functions.

sr01853
  • 6,043
  • 1
  • 19
  • 39
  • `size_t blk_size` is not a function pointer; `size_t` is an alias for an integral type that "can store the maximum size of a theoretically possible object of any type (including array). On many platforms (...) std::size_t can safely store the value of any non-member pointer, in which case it is synonymous with std::uintptr_t." (http://en.cppreference.com/w/cpp/types/size_t) – Utaal Feb 01 '13 at 15:37
0

int (*is_space)(unsigned char); - pointer to integer function that accepts `unsigned

charint (*is_term)(unsigned char);` - the same

void *(*malloc_func)(size_t); and void *(*realloc_func)(void *, size_t); are pointers to void* functions.

See also this

Alex
  • 9,891
  • 11
  • 53
  • 87