O
O
OccamaRazor2016-09-15 17:52:47
Programming
OccamaRazor, 2016-09-15 17:52:47

How to use printf in C to print a unique character like a cent sign or a paragraph sign?

What code do you need to know? HEX, unicode?
printf("§");

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Rou1997, 2016-09-15
@Rou1997

A HEX code is a character number in Unicode or some other encoding, in the console ASCII encoding.

S
Smithson, 2016-09-15
@Smithson

You need to know the code in ASCII (many characters are NOT there).
And you can withdraw through \.
will print the percentage.

M
Mercury13, 2016-09-15
@Mercury13

First, you need to make sure that the console you are working with supports such characters. Here we have a question about this (specifically about Windows; as far as I know, Unixes have plain UTF-8).
How to print Σ(sigma) sign in C++(console application)?
To print this character, you must ...
• or use the "wide" versions of the function (wprintf, wcout, etc.).
• or output this character in UTF-8 encoding.
Source text…
• either keep in UTF-8 and the character in it is in clear text;
• or specify a character in it with UTF-16 encoding for "wide" functions, UTF-8 encoding for "narrow" functions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question