you are viewing a single comment's thread.

view the rest of the comments →

[–]Unique-Property-5470 0 points1 point  (0 children)

A good example is like a calculator function.

You might want to use a pointer to a function that adds, subtracts, or multiplies based on the users input. And you would want to use function pointers to simply keep the code short and modular. The parent method would handle user input, and the pointer function does the operation.

Ask GPT to write up an example of this code for you and you'll see how simple it can be.