'For some reason, when i use getch() my program crash, but if i use cin, then it works

I would like to know what knowledge I lack about inputs of arrays. I want to input one character and then automatically go to the next line of the code.

Here is the code:

char word[21];
for(int i = 0;i < 21; i++)
{
    word[i] = getch();
    //cin>>word[i];
    if(word[i] == '/')break;
}
for(int j = 0;j < strlen(word); j++ )
{
  if(j < (strlen(word) - 1 ))cout<<word[j];
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source