If I wanted perform an arbitrary set of processes, how would I accomplish that? Is there a language agnostic way of describing this?
If you found the previous statement confusing, here is where I will try to explain.
- A variable of a specific data type gives access to one place holder.
int a; - An array allows for a single entry point for a defined set of place holders.
int a[5]; - And a linked list allows for an arbitrary number of place holders limited to the amount of space available.
LinkedList a = new LinkedList;
If a function or sub procedure is like a variable in that a function is a single entry point for one set of procedures, what am I looking for that would allow for an arbitrary set of procedures to be performed from a single entry point.
My best guess at this point I would need a linked list of function pointers to cycle through?
Please treat the following as psuedo code:
int f(int x){
return x*x};
int g(int x){
return x+x};
int (*procedures)(int x)[2]; //<<== no idea if this is even acceptable
procedures[0] = f;
procedures[1] = g;
If it's handy to describe this in terms of a technology, C++ should suffice.
