Waypoint Waypoint - 1 year ago 107
C Question

Simple int to char[] conversion

I have a simple question

How to simply convert integer (getting values 0-8) to char, e.g. char[2] in C?


Answer Source
  int i = 247593;
  char str[10];

  sprintf(str, "%d", i);
// Now str contains the integer as characters

Hope it will be helpful to you.