Question: I wrote a program that lets the user type words and it saves them to a char array until the user types "\*end".How can i make the program stop when the user presses Ctr+Z instead of typing "\*end"?

Here is the code

```
char text[1000][100];

char end[100] = "*end";
int count =-1;

do
{
    count++;
    scanf("%s",&text[count]);

}while(strcmp(text[count],end)==1);

```

Answer: 
It could be [operating system](https://en.wikipedia.org/wiki/Operating_system) specific. The C11 (or C++14) standard does not know about [terminals](https://en.wikipedia.org/wiki/Computer_terminal) (or [terminal emulators](https://en.wikipedia.org/wiki/Terminal_emulator)) or keyboards, only about [standard output](https://en.wikipedia.org/wiki/Standard_streams), standard input, etc....

On Linux, read about [tty demystified](http://www.linusakesson.net/programming/tty/), [termios(3)](http://man7.org/linux/man-pages/man3/termios.3.html) and consider using some library like [ncurses](https://www.gnu.org/software/ncurses/) or [readline](https://cnswww.cns.cwru.edu/php/chet/readline/rltop.html).

BTW, you'll better use C [dynamic memory allocation](https://en.wikipedia.org/wiki/C_dynamic_memory_allocation) instead of using an array of arrays and you should check the result count of [scanf(3)](http://man7.org/linux/man-pages/man3/scanf.3.html). Look into [strdup](http://man7.org/linux/man-pages/man3/strdup.3.html) & [asprintf](http://man7.org/linux/man-pages/man3/asprintf.3.html).
Use the return value of `scanf`

```
do {
    count++;
    if (scanf("%s", &text[count]) != 1) break;
} while (strcmp(text[count], end) != 0);

```