What is CrazyEngico.com (CE)?

CrazyEngico (CE) is a one-stop solution for interview questions and answers, domain knowledge, e-learning, tutorials, articles and many more learning material.
e-learning - Intelligent e-learning tutorials and articles
Domain Knowledge Learn about various business domains/verticals such as Banking, Financial, Insurance, Healthcare and many more...
Interview Questions and Answers - Post your questions and answers. 1000+ database of ready questions and answers available to prepare for an interview.
Tutorials - 300+ video tutorials from beginner to expert level.
Articles - 300+ technical articles to understand concepts.
Forum - A technical forum to post your queries/responses.

Search Questions

Interview Questions/Answers

Interview Q & A >> C++ >> What are function pointers?

Question Navigator Next >>

0        0
What are function pointers? (Views: 1681)


0        0

Function Pointers are pointers, i.e. variables, which point to the address of a function.

Submitted By: Anonymous | Created On: 7/13/2009 9:14:56 AM

1        0

A function pointer always points to a function with a specific signature. Thus all functions, you want to use with the same function pointer, must have the same parameters and return-type.

Submitted By: Anonymous | Created On: 7/13/2009 9:15:47 AM

2        0

Pointer to a function . Function pointers are used for callbacks, and can be used whereever virtual function mechanism is needed.

#include <iostream.h>
int f1()
        cout<<"f1 function called";
        return 5;
void main()
    int i=0;
    int (*fPtr) ();         //Function pointer declaration
    fPtr=f1;                 //Function assigned to function pointer
    i=fPtr();                 //Calling the function using function pointer

f1 function called

Submitted By: SV | Created On: 6/5/2011 10:54:49 PM

Post your Answer
Your answer will be first reviewed by our administrator before it appears on the site.

Your Answer:

Display Name:

By clicking on Submit button you agree to the Terms of Service agreement.

Copyright © 2018 CrazyEngico.com. All rights reserved.
CrazyEngico.com is not responsible for the content and CrazyEngico.com does not evaluate or guarantee the accuracy of any CrazyEngico.com content.
Please read our terms of service agreement before using this site.