473,882 Members | 1,632 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Question: How to printf the semicolon ";"?

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
3 5906
In article <11************ **********@79g2 000cws.googlegr oups.com>,
Ken <bg***@sjtu.org 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.
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
--
"Considerat ion shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Dec 26 '06 #2
2006-12-26 <11************ **********@79g2 000cws.googlegr oups.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
Random832 <ra****@random. yi.orgwrites:
2006-12-26 <11************ **********@79g2 000cws.googlegr oups.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_Keit h) 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

188
17510
by: infobahn | last post by:
printf("%p\n", (void *)0); /* UB, or not? Please explain your answer. */
19
5479
by: v4vijayakumar | last post by:
why the following statement dumps the core(Segmentation fault)? printf("%s\n", __FILE__);
12
43496
by: Zero | last post by:
Hi everybody, i want to write a small program, which shows me the biggest and smallest number in dependance of the data type. For int the command could be: printf("\n%20s\t%7u\t%13i\t%13i","signed int",sizeof(signed int),INT_MIN,INT_MAX);
10
2382
by: lovecreatesbeauty | last post by:
Is parameter type conversion required for the 2nd argument on printf("%p", (void *)&i); ? But one would never call memcpy like: memcpy((void *)pi, (void *)pj, sizeof *pj); /*memcpy((void *)pi, (void *)pj, sizeof *pi);*/ /*size of what?*/ By the way, will the 3rd argument of memcpy follow the size of the 1st or the 2nd argument? If it follows the size of the 1st argument, unwanted data in the memory area pointed by the 2nd parameter...
51
4195
by: Spidey | last post by:
for(;0;) printf("hello"); even the condition s wrong i get a hello printed on the screen y s this happening
6
8811
by: WeiWangJi | last post by:
int i=8; printf("%d\t%d\t%d\t%d\t%d\t%d\n",i,++i,--i,i--,i++,-i--); printf("%d\n", i); why the results is: 8 8 7 8 8 -8 7 How to explain?
26
6885
by: Yevgen Muntyan | last post by:
Hey, It was mentioned elsewhere that printf("%d", INT_MAX); is implementation-defined. Why? Is it because INT_MAX value is implementation-defined so output depends on implementation, or is it something more subtle so that output of the following is also implementation-defined: if (INT_MAX == 65535) printf("%d", INT_MAX);
4
5672
by: liz0001 | last post by:
Hi, I am getting this error when I try to run my code: Missing semicolon (;) at end of SQL statement However, there is a semicolon at the end of my statement. Here is the statement: INSERT INTO Schedule (UserID,MeetingDate,MainID,SecondID,ThirdID,FourthID,AddID) VALUES ('1','6/22/2007','10','12','12','12','13') ON DUPLICATE KEY UPDATE MainID='10',SecondID='12',ThirdID='12',FourthID='12',AddID='13'; *I am generating this SQL from an...
29
11134
by: candy_init | last post by:
Hi all, I just came across the following program: #include <stdio.h> int main() { float a = 12.5; printf("%d\n", a); printf("%d\n", *(int *)&a); return 0;
0
9931
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9776
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10724
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10827
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10403
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9556
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7113
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4599
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3226
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.