} // This to terminate your main
- the second argument of scanf is wrong. It should be app1, not &app1. And good compilers signal that as a warning ...
- You could have written "else" instead of "if (fork)"
- You never use the value of ret. You should because execlp does NOT return unless there is a problem in which case the value of ret may be useful to understand the error
- Why do you add a "-l" argument to your commands ?
- the printf in each case could expose the value of app1 (app2)
- I don't like scanf
- what will happen if you enter commands greater than 9 characters ?