textcolor
function is no longer supported in the latest compilers.
This the simplest way to change text color in Code Blocks.
You can use system
function.
To change Text Color :
#include<stdio.h>
#include<stdlib.h> //as system function is in the standard library
int main()
{
system("color 1"); //here 1 represents the text color
printf("This is dummy program for text color");
return 0;
}
If you want to change both the text color & console color you just need to add another color code in system
function
To change Text Color & Console Color :
system("color 41"); //here 4 represents the console color and 1 represents the text color
N.B: Don't use spaces between color code like these
system("color 4 1");
Though if you do it Code Block will show all the color codes. You can use this tricks to know all supported color codes.