Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,971 questions

51,913 answers

573 users

How to write bold colored text in printf with C

1 Answer

0 votes
#include <stdio.h>

#define RESET       "\033[0m"
#define BOLDBLACK   "\033[1m\033[30m"     
#define BOLDRED     "\033[1m\033[31m"     
#define BOLDGREEN   "\033[1m\033[32m"     
#define BOLDYELLOW  "\033[1m\033[33m"     
#define BOLDBLUE    "\033[1m\033[34m"     
#define BOLDMAGENTA "\033[1m\033[35m"     
#define BOLDCYAN    "\033[1m\033[36m"     
#define BOLDWHITE   "\033[1m\033[37m"     

int main ()
{
    printf(BOLDGREEN "%s\n", "bold green text" RESET);
    printf(BOLDRED "%s\n", "bold red text" RESET);
    printf(BOLDYELLOW "%s\n", "bold yellow text" RESET);
    
    return 0;
}

  
/*
run:
  
bold green text
bold red text
bold yellow text     
  
*/

 



answered Jul 18, 2024 by avibootz

Related questions

1 answer 72 views
72 views asked Jul 18, 2024 by avibootz
1 answer 302 views
1 answer 71 views
1 answer 214 views
1 answer 106 views
106 views asked Jul 29, 2023 by avibootz
1 answer 151 views
151 views asked Dec 2, 2018 by avibootz
...