# Thread: how to stop this proccess prematurely..

1. whats "one off"
i searched in google there is no definition

--
Mats

3. Originally Posted by transgalactic2
i dont know why
??
When do you expect i to equal size? What does i actually equal at that point?

Don't answer just one question. Answer both of them, because until you can answer both questions, you will never be able to solve this problem.

4. i debugged it again
and when i=7 (the last char before enter)
i goes to

Code:
```	 if ((ch=='\n')&&(i!=size))
{
return 0;
}```
so i guessed i[7] gets the \n char
so i changed i==size-1
now it returns 1 but
it doesnt put the 8th number in the array
??
Code:
```#include <stdio.h>

int main()
{
int i;
int input[40];
for(i=0;i<8;i++)
{
printf("%d ",input[i]);
}
printf("\n");
return 0;
}
{
int flag,rt,ch;
if (i==size-1)
{

return 1;
}

flag=scanf("%d",&input[i]);
ch=getchar();
if ((ch=='\n')&&(i!=size))
{
return 0;
}

if (ch<0)
{
return 0;
}

if (flag==0)
{
return 0;
}
else
{
}
return rt;
}```

5. So what do you think you should do to fix that?

--
Mats

6. i should some how catch this eights char using getchar
and put it into the array

but where to do that?

7. Originally Posted by transgalactic2
i should some how catch this eights char using getchar
and put it into the array

but where to do that?
Think about what happens in your code, and where you get to for each possible scenario of newlines, count of i, and numbers entered. Where should you exit the recursion? What are the conditions?

Coding is about solving problems - you _NEED_ to learn to think about what happens in your code, not just repeatedly post "and how do I do that?"

--
Mats

8. i get \n only onces i the end of the array

i dont know why it happens

9. Originally Posted by transgalactic2
i get \n only onces i the end of the array

i dont know why it happens
Because there is only one newline in the input, perhaps?

--
Mats

10. thats how it should be
a row of numbers and enter

what is the problem?

one new line means one enter

11. i solved it thanks

12. how to check if there are more member then the size??

13. If you count to MORE than size and haven't received a newline yet, is that a good enough clue?

--
Mats

14. nothing stops me from counting further
so its not much an obsticle

15. Originally Posted by transgalactic2
nothing stops me from counting further
so its not much an obsticle
Nothing, except your code, you mean?

--
Mats