Lets say I have the below C code:
int getLine (char line[])
{
int c, i=0;
while( (c=getchar()) != EOF )
line[i++]=c;
line[i++] = c;
Converting my comment into an answer:
On which platform? On Unix and derivatives, you would type the EOF 'character' twice — usually control-D rather than control-Z, though. That may also work on Windows; I don't know, but it is worth a try.
(A response comment affirms that the platform is Windows.)
On Unix, control-D makes the data on the line available to the program. The first control-D gives it what you've typed already; the second gives it zero bytes to read, which is the indication of EOF.