The segmentation error is you are defining the size of the array as 1 and you are doing the scanf in the position 1 but it should be at 0. Also you need to specify the address of the variable and not the variable.

What's the point of a one-byte array? Why not just define a char? You also might as well redirect a line at a time since the standard libraries don't fetch a character at a time. They don't give you anything until the end of the line is encountered. You have to go implementation-specific for keystroke-level input.