why function pointers and call back ?

Status
Not open for further replies.

bhadmanathan

Junior Member level 1
Joined
May 7, 2016
Messages
18
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
187
I read the tutorial about function pointer. I understood the syntax and concept. But..


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
void A()
    {
        printf("HELLO");
    }
    void B(void (*p)())
    {
         p();
    }
    main()
    {
          B(A);      or       A();
    }



Instead of calling a function indirectly, we can simply call like A();

Is there anything in terms of memory....?



Thanks in advance
 
Last edited by a moderator:

Example widely used for data reception:
A is the callback function executed by an interruption.
B enable this interruption at the beginning.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…