if the teacher and textbook are of little help then the only recourse is to tinker
here is what you do...
take your code base,
compile it,
and run it with a series of different inputs
then go back to the code base and change one thing in it that you are having a hard time understanding, only one thing at a time and only slightly so that you can recognise and keep track of the changes,
then recompile and send the same series of inputs
try changing
to
Code:
printf("my lovely shell :) ");
how did the output change? what can you now infer about the code from seeing these changes?
if a change completely breaks the program then search for error codes online
for instance looking at this potentially confusing line:
Code:
arg = strtok(NULL, " \t\n");
if i change strtok to strtik, the program fails.. better investigate..
now i know somewords followed immediately by a parenthesis signals a function call, but the function is vacant from the code, so maybe it is built into the system... searching:
https://www.google.com/search?q=strtok
lands me here:
http://www.cplusplus.com/reference/cstring/strtok/
this explains clearly what strtok does, what arguments it takes and what kind of activity i should expect when i run it
do this for every bit you find confusing
move line by line
now with your new knowledge go back to the original code base and change something else,
repeat