Read strings line by line until Ctrl+C is pressed
Here is what i have
The above code properly reads every string entered. It is correct.
for (i=0;i<10 ;i++ ) printf("%s\n",sp[i]);
However, this is an infinite loop and I want it to break from it when the user presses Ctrl+C or Ctrl+Z depending on the shell. Break from the while loop, not exit from a program.
I know there is getchar().... but it doesnt suite here.
Any help is appreciated!