Home > Back-end >  What does this C language statement mean?
What does this C language statement mean?

Time:12-07

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.

CodePudding user response:

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;
}
  • Related