Question: How to printf the semicolon ";"?

K

Ken

Hi all,

I want to printf a sentence with a semicolon, for examples:
printf(" I like C language; You like C++ language.");
But C compiler alway identify the semicolon as a end of a sentence and
presents an error.

My question is:

How to printf the semicolon ";" in C language?

Sincerely,

Ken
(e-mail address removed)
 
R

Richard Tobin

I want to printf a sentence with a semicolon, for examples:
printf(" I like C language; You like C++ language.");
But C compiler alway identify the semicolon as a end of a sentence and
presents an error.

You don't need to do anything special to print a semicolon. Well,
perhaps you need to find a better C compiler. Can you give us a
complete program that won't compile, and the name of the compiler so
that we can avoid it, please.

-- Richard
 
R

Random832

2006-12-26 said:
Hi all,

I want to printf a sentence with a semicolon, for examples:
printf(" I like C language; You like C++ language.");
But C compiler alway identify the semicolon as a end of a sentence and
presents an error.

Your C compiler is wrong, or that is not the code you tried to compile.
 
K

Keith Thompson

Random832 said:
Your C compiler is wrong, or that is not the code you tried to compile.

If I were sufficiently interested, I'd be willing to bet a fairly
large amount of money that his compiler is not at fault.

Ken: You print a semicolon the same way you print, say, an 'X'. The
printf call you showed us looks perfectly correct (except that you
probably want a \n at the end of the line).

Write a small complete program that includes the above statement. If
it prints the semicolon, you're done. If it fails, post your code
(the *exact* code: copy-and-paste it, do *not* re-type it) and tell us
exactly how it fails (again, copy-and-paste any error message).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top