wangz
wangz

Reputation: 55

What does this C language statement mean?

int (*EVP_MD_meth_get_cleanup(const EVP_MD *md))(EVP_MD_CTX *ctx)

I find this code piece, not sure how to understand it. I think EVP_MD_meth_get_cleanup is the name of the function pointer type, return int, but not understand the argument part.

Upvotes: 1

Views: 78

Answers (1)

KamilCuk
KamilCuk

Reputation: 142005

EVP_MD_meth_get_cleanup is a function, that takes const EVP_MD *md as an argument, and returns a function pointer. That function pointer takes EVP_MD_CTX *ctx and returns an int.

Nothing better than an example:

int somefunction(EVP_MD_CTX *ctx) {
    stuff();
}

int (*EVP_MD_meth_get_cleanup(const EVP_MD *md))(EVP_MD_CTX *ctx) {
   return somefunction;
}

Upvotes: 3

Related Questions