As Moschops said, it depends on the operating system, on the C compiler and libraries you are using, and in some cases, the specific type of console you are working with. I'm going to guess that you are working with a DOS console running under Windows, possibly in a DOS emulator such as Dosbox. I'll further speculate that you are using Turbo C or Turbo C++, since hardly anyone working with modern tools is going to be interested in doing this. Is this a fair assumption?
If you run a Windows box, you can use this approach ...
// change text color in Windows console mode
// colors are 0=black 1=blue 2=green and so on to 15=white
// colorattribute = foreground + background * 16
// to get red text on yellow use 4 + 14*16 = 228
// light red on yellow would be 12 + 14*16 = 236
// tested with Pelles C (vegaseat)
#include <windows.h> // WinApi header
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
// you can loop k higher to see more color choices
for(k = 1; k < 255; k++)
printf("%3d %s\n", k, "I want to be nice today!");
getchar(); // wait