int to char question

PaulS:
Then, no, you are not using sprintf() correctly.

The way you have c defined, it is a pointer. What does it point to? Nothing. And, yet, you as sprintf() to write to the memory pointed to by c.

char c[4];

sprintf(c, "%d", red);



would work.

It does work...but only partially