How to flush the stdin??
Why is it not working in the following code snippet?
#include #include #i
You are overriding the last element of the input in arg with '\0'. That line should be arg[i]='\0'; instead (after error and boundary checking you are missing.)
arg
'\0'
arg[i]='\0';
Other's already commented of the flushing part.