i want to read space separated integer into an array and when i press enter it should stop reading at any point of time, how to implement loop for this prog
A good way is to use getchar() and a character to check ENTER in your program by checking ASCII value
getchar()
ENTER
while(1) { char d; d=getchar(); if(d==13 || d==10) break; arr[j++]=d-'0'; }
it will terminate as soon as you will press enter. More discussion is already provided on this So post