Passing a function another function

wildbill:
You can certainly use a pointer to a function for this purpose, but I'm a little unsure as to why it's necessary here. I'd expect all you're really doing is specifying ingredients and amounts, so you just need to pass that data, which might well be just an index into an array of structs held in progmem. Even if there are special handling instructions like "stir" or "add ice", these can be specified in the data as flags.

Finally, if there really are drinks that do need a function to handle them, you might consider specifying them in the struct. Most of these function pointers would be null, but it would enable you to override the default handling for drinks that need something unusual. Disclaimer: I haven't done this on an Arduino so I'm not sure of the subtleties that the Harvard architecture brings here - it would likely take a bit of time figuring out with progmem directives.

I would use a class to represent drinks. That way, you can represent most recipes just by storing different data; but if you really do need special steps for some drinks, you can override the function that does the dispensing and mixing as well - which is neater than using function pointers.