I understand that function pointer is pointer in c language that can store the address of a function, and can be use in call back
simple code
if i use function pointer or function name I get same resultCode:#include <stdio.h> void foo() { printf(" Welcome "); } int main() { void (*fp)() = &foo; // foo(); fp(); return 0; }
Could you please provide some clarity on why and when function pointers are commonly used ?
I'd appreciate any examples you could offer to help me grasp their usefulness ?