|
|
|
|
Download e-Books
Aptitude Interview Questions
Online Quiz
|
Home > C Interview Questions > How do you use a pointer to a function ?
The hardest part about using a pointer-to-function is declaring it.
The strcmp() function is declared in this way:
To set up pf to point to the strcmp() function, you want a declaration
that looks just like the strcmp() function’s declaration, but that has
*pf rather than strcmp: After you’ve gotten the declaration of pf, you can #include and assign the address of strcmp() to pf: pf = strcmp;
|