I am trying to \"trap\" keyboard inputs from user, meaning the code will prevent them from entering certain characters, which in this case prevents the input of numbers and spec
Reading uninitialised variables like done to buffe
here:
if (c1=='\r' && strlen(buffe)==0)
provokes undefined behaviour, anything could happen afterwards. Do not do this.
Always initialise variable before reading them.
In this case you might like to simply do:
char buffe[32] = "";
or (as already proposed by others) the more generic way:
char buffer[32] = {0};
More complicated but also valid would be to do:
char buffer[32];
strcpy(buffe, "");
or
char buffer[32];
memset(buffe, 0, sizeof(buffe));