Question: I am starting to write a command line converter and the only concern I have is user input (rest wont be hard). The program will have few commands like (convert 2 m to km), so when the user enters that, the program will output the converted value. My question is, what is the best way to parse user input and determine the command that user entered?. Should I divide user input into array of words and then pass to a function, so it can do something or there is another way?

Answer: 
If you only have a few commands, it will be best to just `strtok(input, ' ')`, which just splits up a string into an array of words in the command (assuming your command words are all separated by spaces). Then you can do some simple if/switch checks to see which command the user entered. For a larger number of commands (where some may be similar), you will probably need to implement or at least write out a DFA (deterministic finite automata).
An array of structures will be fine. The structure may be like this:

```
struct cmd
{
    char **usrcmd;
    void (*fc)();
};

```

Then you just have to iterate the array and compare the user input and the usrcmd[0] field (I assume the command is the first word).

However this solution is not the best way to go if you have a lot of user commands to handle.