Like Tree1Likes
  • 1 Post By laserlight

What is callback formula in C?

This is a discussion on What is callback formula in C? within the C Programming forums, part of the General Programming Boards category; Hi , I have studies some material in google. But i confused by reading all those materials. Actually any one ...

  1. #1
    kotin
    Join Date
    Oct 2009
    Posts
    132

    What is callback formula in C?

    Hi ,

    I have studies some material in google. But i confused by reading all those materials.

    Actually any one can explain me the simple logic for Callback?

    I know that callback means recruiting an Employee after layoff :-). How this meaning is related to "C" call back functions?

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,705
    Use qsort to sort an array of integers. The comparison function that you use is a callback function.
    whiteflags likes this.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    kotin
    Join Date
    Oct 2009
    Posts
    132
    Hi light,

    you mean to say qsort and comparison function both are executables. so a callback is a reference to executable code(comparison function executable code), that is passed as an argument to other code (qsort code) ?

    am i correct?

    Note:
    1. from wikipedia "In computer programming, a callback is a reference to executable code, or a piece of executable code, that is passed as an argument to other code. This allows a lower-level software layer to call a subroutine (or function) defined in a higher-level layer."

  4. #4
    kotin
    Join Date
    Oct 2009
    Posts
    132
    Hi,

    can any one give small example for the statement on callback as "A callback is often back on the level of the original caller" ?

    I did not understand regarding that statement.

    Thanks in advance.

  5. #5
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,705
    Quote Originally Posted by nkrao123@gmail.
    you mean to say qsort and comparison function both are executables.
    We could say that all functions are executable, so: of course.

    Quote Originally Posted by nkrao123@gmail.
    so a callback is a reference to executable code(comparison function executable code), that is passed as an argument to other code (qsort code) ?

    am i correct?
    In this context, we could just say that a callback is a function that is passed as a function pointer argument to another function from which it is called.

    Quote Originally Posted by nkrao123@gmail.
    can any one give small example for the statement on callback as "A callback is often back on the level of the original caller" ?
    In other words, the article claims that a callback is often defined in the same module as the original caller.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. callback function
    By koszta in forum C Programming
    Replies: 2
    Last Post: 02-23-2009, 11:51 AM
  2. callback in a class, what do I do?
    By Yarin in forum C++ Programming
    Replies: 5
    Last Post: 08-17-2007, 11:11 AM
  3. Callback functions
    By linuxdude in forum C Programming
    Replies: 2
    Last Post: 01-03-2004, 05:23 PM
  4. Callback functions
    By WebmasterMattD in forum C++ Programming
    Replies: 3
    Last Post: 11-07-2003, 06:45 PM
  5. help!! callback in dll....
    By kimcs in forum Windows Programming
    Replies: 4
    Last Post: 06-30-2003, 07:47 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21