I have a program where I need to scanf a string, which I know it will be only 2 characters long. (for example: \"ex\").
what is the proper way to do that?
You can´t do that.
scanf will do nothing to prevent it, but it can (or, in larger programs, will)
lead to problems later on. Like unexpectly changed variable values, program crashes...