Waypoint Waypoint - 1 year ago 136
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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download