Waypoint Waypoint - 2 months ago 21
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?

Thanks

Answer
main()
{
  int i = 247593;
  char str[10];

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

Hope it will be helpful to you.