You can add to your code, but the beauty of a compiler is that it can also take a simple snippet of code, modify it, and see the changes reflected in the compiled assembly code.
If you’re not sure what a function pointer is, it’s a pointer to a function. If you have a function name that you know, you can use the function pointer to call that function. It works the same way in C++ as in C (except it’s more complicated). I’m not going to go into a whole explanation of what a function pointer is, but it’s a small example you can add to your code.
C++ is pretty much the best language I’ve ever used, and I don’t have to be the best compiler. If you have a problem that needs to be resolved in a matter of days, it’s probably time to make it a little easier. I just do it for free as well.
The point is that you can pass the function as an array to use with an array, for instance. In C++ I would do this in the same way as I’d do it in C++.
We’re not going to do it that way in this.
Lets say you have a problem that you need to solve and you have an array that you need to pass in. Instead of doing it the C way, Id just make a function that takes the array as a parameter. Lets say you pass in the array to the function, then you can call the function by simply using array[i]. Thats the C way. You can make the function a little easier by changing the return value from function to function_pointer.
A function is a constructor that takes a function as a parameter. In a C program, there are a few possible arguments.
The first argument is the name of the function (there are more, but this is a good start). The second argument is the actual function to be called. You can pass in a function pointer as well. That way, when the function is called, the function pointer points to the function being called. So when you call the function i.e. arrayi(arr), the function pointer points to function i.e. arrayi.
The function pointer argument is the function, and function pointer is a really useful tool in C programs because it allows you to pass a function pointer as an argument into another function. The function pointer allows you to say “I’ll call it arrayiarr, and I’ll pass a function pointer to it.” It’s a very useful way of getting around static variables. I’ve used it to pass arrays into other functions, and it’s nice to see that it works the same way with functions.