Function Pointers

Discussion in 'C Programming' started by Vasa, Feb 1, 2011.

  1. Vasa

    Vasa

    Joined:
    Jan 29, 2011
    Messages:
    3
    Why we use function pointers?

    Eg:
    Roughly I written the code for understanding purpose only...

    char (*ptr_fun)(); // pointer to a function which returns char
    char fun();
    char ch;
    ptr_fun = &fun; // assign the address of that fun to that pointer


    Now the question is, what is the different between the below two function call even though both perform the same operation
    ch = fun();
    ch = *ptr_fun;

    Kindly explain in advanced(detailed) manner.
    Last edited: Feb 1, 2011
    Vasa, Feb 1, 2011
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Phil
    Replies:
    1
    Views:
    639
    llewelly
    Sep 16, 2003
  2. muser
    Replies:
    3
    Views:
    750
    Ron Natalie
    Sep 18, 2003
  3. Peter Goddard

    void pointers & void function pointers

    Peter Goddard, May 16, 2005, in forum: C Programming
    Replies:
    3
    Views:
    505
    Peter Goddard
    May 16, 2005
  4. n2xssvv g02gfr12930

    Smart pointers and member function pointers

    n2xssvv g02gfr12930, Nov 26, 2005, in forum: C++
    Replies:
    3
    Views:
    461
    n2xssvv g02gfr12930
    Nov 27, 2005
  5. cerr

    pointers, pointers, pointers...

    cerr, Apr 7, 2011, in forum: C Programming
    Replies:
    12
    Views:
    654
Loading...

Share This Page