Jun 1, 2016 #1 B 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: Jun 1, 2016
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
Jun 13, 2016 #2 E enren Newbie level 6 Joined Nov 1, 2009 Messages 14 Helped 7 Reputation 14 Reaction score 7 Trophy points 1,283 Location France Activity points 1,351 Example widely used for data reception: A is the callback function executed by an interruption. B enable this interruption at the beginning.
Example widely used for data reception: A is the callback function executed by an interruption. B enable this interruption at the beginning.
Jun 13, 2016 #3 AdityaRajNayak Junior Member level 1 Joined Dec 8, 2013 Messages 15 Helped 5 Reputation 10 Reaction score 5 Trophy points 3 Location India Activity points 118 Hi, Just gone through following link for 'advantages of function pointers' which can be helpful. https://www.allinterview.com/showanswers/28663/what-is-the-advantage-of-function-pointer.html
Hi, Just gone through following link for 'advantages of function pointers' which can be helpful. https://www.allinterview.com/showanswers/28663/what-is-the-advantage-of-function-pointer.html