Abstract
We now leave data structures for a spell to talk about something new: pointers to functions. Like pointers to data, pointers to functions give us a level of indirection, so we can hold in a variable the address of an object rather than the object itself. Further, with a pointer, the same variable can refer to different objects over time.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
When you have callbacks that manipulate data, rather than just listen to events, they are sometimes called hooks. The way you use them is the same.
- 2.
We probably shouldn’t, because the bits could be used in the future. I don’t expect our data busses will be larger in the near future, but it is probably still best not to do what I am showing you here!
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2021 Thomas Mailund
About this chapter
Cite this chapter
Mailund, T. (2021). Function Pointers. In: Pointers in C Programming. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-6927-5_13
Download citation
DOI: https://doi.org/10.1007/978-1-4842-6927-5_13
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4842-6926-8
Online ISBN: 978-1-4842-6927-5
eBook Packages: Professional and Applied ComputingProfessional and Applied Computing (R0)Apress Access Books