Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


What is CALLBACK? How it work?
what is the advantage of CALLBACK,
please explain with an example

Answers were Sorted based on User's Feedback



What is CALLBACK? How it work? what is the advantage of CALLBACK, please explain with an example ..

Answer / zero zero....

• callback function is a function that is called
through a function pointer.
• pass the pointer (address) of a function as an
argument to another, when that pointer is used to call the
function it points to it is said that a call back is made.
// 2.1 define a function pointer and initialize to NULL
int (*pt2Function)(float, char, char) =
NULL; // C
int (TMyClass::*pt2Member)(float, char, char) =
NULL; // C++
int (TMyClass::*pt2ConstMember)(float, char, char) const =
NULL; // C++

• A callback function is a function that is passed
to another function (in the form of a pointer to the
callback function) so that the second function can
call it. This is simply of way of making the second
function more flexible without the second function needing
to know a lot of stuff

Uses:
• A callback can be used for notifications
• callback functions can be used for updates, sort of
like hooking into another function. For example, consider a
function that downloads files using http. Your application
may want to display progress to the user. You could pass a
callback function (display progress) into the download
function so that it calls your display function everytime
it reads from the socket. At least that is my
understanding...

Is This Answer Correct ?    30 Yes 6 No

What is CALLBACK? How it work? what is the advantage of CALLBACK, please explain with an example ..

Answer / manjula

a callback function is a function that is called through a
function pointer. If you pass the pointer (address) of a
function as an argument to another, when that pointer is
used to call the function it points to it is said that a
call back is made.

Is This Answer Correct ?    14 Yes 4 No

What is CALLBACK? How it work? what is the advantage of CALLBACK, please explain with an example ..

Answer / kishore kumar naik p

Call back functions are related to function pointers. To
understand this see the syntax of standard "qsort" below

void qsort(
void* base,
size_t num,
size_t width,
int (
__cdecl* compare
)(
const void* elem1,
const void* elem2
)
);
(refer MSDN for more info on "qsort")

In above syntax The fourth argument is function pointer.
So when we call this function we will send the address of
"Compare" function to "qsort" function and "Compare"
function will be called by the "qsort" depending on the
logic inside "qsort" function. In this case "Compare"
function is called back by the "qsort". So "Compare" is a
call back function here.

Is This Answer Correct ?    8 Yes 3 No

What is CALLBACK? How it work? what is the advantage of CALLBACK, please explain with an example ..

Answer / ravi

A callback function is a function that gets invoked by the
OS when the function having its pointer as one of its
arguments is invoked.

Is This Answer Correct ?    10 Yes 9 No

What is CALLBACK? How it work? what is the advantage of CALLBACK, please explain with an example ..

Answer / ratnesh sachan

Callback function is a function that is called through a
function pointer. If you pass the pointer(address) of a
function as an argument to another, when that pointer is
used to call the function it is point is said that a call
back is made...

#include<iostream.h>

int sachan(int a,int b)
{
printf("%d %d",a,b);
return 0;
}
main()
{
int(*abc)(int,int);
abc=&sachan;
abc(10,20
);
}

Is This Answer Correct ?    5 Yes 5 No

What is CALLBACK? How it work? what is the advantage of CALLBACK, please explain with an example ..

Answer / rahul

Its a function called by OS. This function is like telling
OS to convey about certain event or many events to your
program by calling this function.

Is This Answer Correct ?    6 Yes 8 No

Post New Answer

More MFC Interview Questions

how can u change button shape at run time

3 Answers   Samsung,


Why not virtual functions to handle messages?

5 Answers  


What is difference between the TCP/IP and UDP socket

5 Answers   Invensys,


How can we create thread in MFC framework?

3 Answers  


1)why we cant create more than one instance of the class Derived from CWinApp

5 Answers   Alstom,


What are the special requirements for dialog box resources used in a form view?

2 Answers  


In MFC By Using Communication Between Dialog Boxes,How Can We Send Message Of one Dialog Box To Another Dialog.?

3 Answers   Financial Technologies,


Given two processes, how can they share memory?

2 Answers   Microsoft,


Do you have an idea about MFC?

0 Answers   C DAC, CDAC,


How to handle dynamic menus in mfc? What happens when client calls cocreateinstance?

0 Answers  


What are the types of button controls?

10 Answers  


What is userdefine Messages in MFC?

1 Answers   HCL,


Categories