Ascii code of backspace button is 127, so every function returns an integer from terminal input will probably return 127 in case of backspace. Be careful because it is the same code for delete button.
Linux
See this answer first and implement your own getch() then follow Windows code example (obviously without conio.h lib).
Windows
Just add #include<conio.h>
in the beginning of your source file.
This is my SSCCE, just need to write something like this
int main(void) {
int c;
while (1) {
c = getch();
if (c == 127) {
printf("you hit backspace \n");
} else {
printf("you hit the other key\n");
}
}
return 0;
}