Function Pointers and Regular Pointers
Explore how function pointers differ from regular pointers in C. Understand that function pointers point to read-only code memory, why writing to them is prohibited, and how function names act as addresses. Learn to call functions using pointers efficiently.
We'll cover the following...
We'll cover the following...
Introduction
There are a lot of similarities between function pointers and pointers to variables. However, function pointers have a few particularities, which we’ll now discuss.
Function pointers are read-only
Function pointers point inside the .text section, which should get mapped in a read-only memory area. As stated previously, it helps protect against code injection attacks. Moreover, it wouldn’t make ...