By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,924 Members | 1,142 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,924 IT Pros & Developers. It's quick & easy.

Question: How to printf the semicolon ";"?

P: n/a
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
bg***@sjtu.org

Dec 26 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
In article <11**********************@79g2000cws.googlegroups. com>,
Ken <bg***@sjtu.orgwrote:
>
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
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Dec 26 '06 #2

P: n/a
2006-12-26 <11**********************@79g2000cws.googlegroups. com>,
Ken wrote:
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.
>
My question is:

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

Sincerely,

Ken
bg***@sjtu.org
Dec 26 '06 #3

P: n/a
Random832 <ra****@random.yi.orgwrites:
2006-12-26 <11**********************@79g2000cws.googlegroups. com>,
Ken wrote:
>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.
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).

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Dec 26 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.