When you define a new variable its value isn't "empty" but unitialized. Trying to read an uninitialized variable is undefined behaviour and will not give you the result you desire.
If you want to have it in a certain state, you need to assign a value that you know you will not get in any other way, the best value for this would be NULL, but you may choose any value that you know the variable will not be assigned. If you can't guarantee any such value, you will have to use another variable (most fitting is bool). Best to use them together in a struct
char userInput = NULL;
//...
while (condition)
{
userInput = GetInput();
if (userInput)
{
//do stuff
}
userInput = NULL;
}
Using a struct and an extra status variable:
struct UserInput { // Declare UserInput struct type
bool initiated;
char c;
} userInput; // create a variable userInput of type UserInput
userInput.initiated = false;
//...
while (condition)
{
userInput = GetUserInput(); //GetUserInput also changes the value of initiated to true
if (userInput.initiated)
{
//do stuff
}
userInput.initiated = false;
}