Is there ANY way to write code which calls a function directly, based on a user's input? ie. NOT using if/ else or switch statements. Even if this means writing an external C function/ program. Something on the lines of:
Functions names are lost after the program is compiled, so it's not that easy.
You can do with an array, each item of the array containing the function name as a string, and a function pointer. Use a for loop to compare the user input with each items names in the array ; if it matches, call the function pointer.
Is it possible to access an internal function like 'digitalWrite()' directly, without using pointers, if/ else or switch statements? Or do the same issues apply?
Can you use function pointers to point to internal functions?
to the compiler there is no difference between your own function or functions provided by Arduino like digitalWrite. Once it's compiled, it's all your code, so you can take the address of any function.
But as said before, function names do go away when you compile, it's not an interpreted language environment. Once in your arduino it's just bytes and pointers etc, nothing trying to parse a function name dynamically to find out what to do next.
if you were trying to tell us what's the goal, may be we can suggest an alternative approach.
As already pointed out, that's not possible. The Arduino simply doesn't know anything about your function names, until you explicitely write them as strings into your code and compare which you want to execute. However you do that.
As the other said, you need to develop specific code for this. Ideally you build a "language" with grammar rules, keywords etc and then your arduino code is a parser for that language β you add an interpreter on top of your arduino.
there are simple examples out there you could look at, here is the first google hit:
Other languages that can run on at least some arduinos can do this (usually with a major performance impacts.). Basic interpreters and bitlash (sort of), and Forth, python, LisP, etc have inherent internal symbol tables.
Function pointers are a red herring, the compiled code needs to know the function name to get the pointer. There is no magic solution here, it is a Simple Matter of Writing Code.
I guess if you had standard functions like "digitalWrite" then it could be self-contained, and you could add custom commands at run-time. All you are doing is writing your own interpreter (which was suggested earlier).