text color in c code example
Example: change text color c
#include <stdio.h>
#include <windows.h>
#define COLOR_DEFAULT 7
#define LIGHT_RED 12
void setColor(int color);
int main()
{
setColor(LIGHT_RED);
printf("This text is red");
setColor(colorDefault);
}
void setColor(int color)
{
HANDLE hConsole;
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole, color);
}