[Solved] Could not push integer value in Stack. Can not convert char to int [closed]


Apparently type char is converted to ascii code. You have to use string to get the real number. Try this

if (Char.IsDigit(c)) intChar.Push( Convert.ToInt32(c.ToString()) );

another way is to use GetNumericValue function. Since it returns double, it needs to be cast to int.

if (Char.IsDigit(c)) intChar.Push( (int)Char.GetNumericValue(c) );

solved Could not push integer value in Stack. Can not convert char to int [closed]