convert char to int in c++ for any integer code example Example 1: c convert char to int int i = (int)(c - '0'); Example 2: convert char to int c++ int x = character - '0'