130: Data Types: Function Pointers Part 1.

Take Up Code - Un pódcast de Take Up Code: build your own computer games, apps, and robotics with podcasts and live classes

Categorías:

You may not always need to work with this data type but that doesn’t mean you can ignore it. If you don’t at least know the basics, then you’ll get lost in code that uses function pointers. You can listen to the episode for the full description. I’ll use this space to show you the difference between a function declaration and a function pointer.// Method declaration. int addNumbers (int firstNumber, int secondNumber); // Method pointer variable declaration compatible with the addNumbers method. int (*functionPtr)(int, int); // Assigning the address of the addNumbers method to the functionPtr pointer variable. functionPtr = addNumbers; // Calling the addNumbers method through the function pointer. int result = functionPtr(5, 10);

Visit the podcast's native language site