I have been going through The C Programming Language by Brian W. Kernighan and Dennis M. Ritchie and am at Character Input and Output, specifically on File Copying. The example in the book

```
#include <stdio.h>

int main(void)
{
    int c;

    c = getchar();

    while (c != EOF)
    {
        putchar(c);

        c = getchar();
    }

return 0;
}

```

works perfectly.

But I decided to put my own spin on things and rewrite it a bit:

```
#define <stdio.h>

int main(void)
{
    int c;

    printf("Please enter a digit: ");
    c = getchar();

    while (c != EOF)
    {
        printf("The digit entered was: ");
        putchar(c);

        printf("Please enter a digit: ");
        c = getchar();
    }

return 0;
}

```

After compiling and executing, the result of my code is:

```
Please enter a digit: 9
The digit entered was: 9Please enter a digit: The digit entered was:
Please enter a digit: *cursor is here*

```

The input should be:

```
Please enter a digit: 9
The digit entered was: 9

Please enter a digit: *the cursor should be here*

```

Also, I have a little problem understanding EOF. It would be great if someone could help me with these issues.

Thank you!