answersLogoWhite

0

What are callback functions?

Updated: 8/11/2023
User Avatar

Wiki User

18y ago

Best Answer

In computer science, a callback is executable code that is passed as an argument to other code. It allows a low level software layer to call a function occurring in a higher level layer. Usually the higher level code first calls a function within the lower level code passing to it a pointer or handle to another function. Then the lower level function in the course of executing may call the passed-in function any number of times to perform some subtask. Another option is that the lower level function registers the passed-in function as a handler that is to be called asynchronously by the lower level at a later time in reaction to something. A callback can be used as a simpler alternative to polymorphism and generic programming, in that the exact behavior of a function can be dynamically determined by passing different (yet compatible) function pointers or handles to the lower level function. This can be a very powerful technique for code reuse.

User Avatar

Wiki User

18y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

9y ago

In computer programming, a callback is a mechanism that allows one function (the callback function) to be passed to another function (the callee) via an argument. The callback function may be a (pointer to) function, a function object reference or a llambda expression. The caller can then invoke the callee with different callbacks to obtain different results from the same function.

As an example, a sorting algorithm will sort a sequence container in ascending order by default. It achieves this by invoking the less-than operator upon the container's elements to compare them. But if the element's do not have a less-than operator, or the user wants to sort the elements by some other order (such as descending order), they must provide a user-defined callback because the less-than operator is the default callback.

This answer is:
User Avatar

User Avatar

Wiki User

9y ago

A callback is a return telephone call, an official product recall, or the return of a situation to the previous situation.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are callback functions?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

When a function is used as an argument in another function?

It is called callback function. For an example see the qsort function.


What is a callback URL?

A "callback URL" is the web address an API needs to send information for use in a different web site. For example, a web developer is building a web application for use in conjunction with another web service's API (such as Facebook or Last.fm). The application is hosted on the web developer's server, and the other web service stores the callback URL so that it knows where to send information when it is requested by the developer's application. See Also: http://en.wikipedia.org/wiki/Callback_(computer_science)


What is callback function in c?

In computer programming, a callback is executable code that is passed as an argument to other code. It allows a lower-level software layer to call a function defined in a higher-level layer. Usually, the higher-level code starts by calling a function within the lower-level code passing to it a pointer or handle to another function. While the lower-level function executes, it may call the passed-in function any number of times to perform some subtask. In another scenario, the lower-level function registers the passed-in function as a handler that is to be called asynchronously by the lower-level at a later time in reaction to something. A callback can be used as a simpler alternative to polymorphism and generic programming, in that the exact behavior of a function can be dynamically determined by passing different (yet compatible) function pointers or handles to the lower-level function. This can be a very powerful technique for code reuse. Callback functions separate the caller from the callee, the caller doesn't care who the callee is For complete understanding we need to know about Function pointers in c. check the link below


What functions do the telephone have?

different pats and functions of a telephone


Built-in functions in C?

You can have #include after Stdio.h ...it has so many built in mathematical functions like CIRCULAR FUNCTIONS, ABSOLUTE VALUE and more..Sadly, built-in functions and library functions are different things... there are no built-in functions in C (except for sizeof, which isn't an actual function).

Related questions

How do you write a menu driven programmein c?

Learn how to use callback functions and the answer to the question should be evident.


What is callback?

a callback is when you call someone back !!!


When was The Callback created?

The Callback was created on 2012-02-13.


When was The Callback Queen created?

The Callback Queen was created in 2012.


How do you call a function in GUI in matlab?

Just type it in the command line. That will call functions, scripts, load data (that are in the correct directory).


Which remote access callback option provides the greatest level of security?

Callback to a preset number.


What actors and actresses appeared in The Callback - 2009?

The cast of The Callback - 2009 includes: David Youse


What are the release dates for Callback - 2005 I?

Callback - 2005 I was released on: USA: 1 December 2005 (limited)


What is meant by the term callback in computer programming?

The term callback in computer programming can have more than just one meaning. Mainly the term callback means a code that is an argument to another existing code.


Where to get a callback URL for Facebook?

You do not "get" a callback URL. The callback URL refers to the location of the server that is hosting your application. For instance, MyFBGame might be hosted at www.myfbgame.com. Some basic details can be found at http://developers.facebook.com/get_started.php.


What are the release dates for Callback - 2006?

Callback - 2006 was released on: USA: 9 May 2006 (Cakewalk Film Festival)


What are the release dates for Callback - 2008?

Callback - 2008 was released on: USA: 1 August 2010 (New York City, New York)