Home > Net >  How to bold text in c program
How to bold text in c program

Time:02-27

How do i Bold my PrintF .. ( I am new in C)

#include <stdio.h>
int main()
{
int i;
for(i=1; i<=5; i  )
printf("Md.Mehedi hasan");
return 0;
}

CodePudding user response:

If your terminal supports ANSI Escape Sequences, you can do this:

#include <stdio.h>

int main(void)
{
    for(int i = 1; i <= 5; i  )
        printf("\e[1mMd.Mehedi hasan\e[m");
    return 0;
}

The \e is the ESC character (ASCII 27 or 0x1B), and ESC [ 1 m sets bold, and ESC [ m resets the display attributes, which resets bold.

  • Related