'How to bold text in c program

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;
}


Solution 1:[1]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 SGeorgiades