Search code examples
ctextprintfadditionemoji

How do I add an emoji on my printing text using C language?


int main()
{

   // istead of :) i want to have an emoji added to my text.

  printf("Thank you for looking into my question :) ");

  return 0;
}

Solution

  • You look up the unicode code for the emoji of interest, prefix the code with the universal character name \U when printing:

    #include <stdio.h>
    
    int main() {
        printf("%s", "\U0001f600"); // :-)
        return 0;
    }
    

    Your terminal must support unicode and the font you use must have a glyph defined for the emoji.