How to convert int to char

I'm going to convert int to char like: 2 -> '2' not 68 -> 'D' but I don't know what to do. Any idea? Thanks.
  int val = 2; 
  char c; 
  c = (char)(val + '0');  // Assumes val is only 0-9 

Not sure what you mean by "not 68 -> 'D' "
OK. Thanks.
I meant (char)68 -> 'D'.
Still don't understand what you're saying about (char)68 -> 'D'
I think OP means that the program should only convert individual digits to char representation, but should not convert numbers like 68 to char which will result in a character like 'D'. In that case, OP should be calling the isdigit function prior to converting
Topic archived. No new replies allowed.