Hello everyone,
I am surprised to see that the value of sign ' is the same as \'. So,
there is no need to add sign \ before sign '? In my past knowledge of
sign ', we always need to add sign \ before sign '. Any comments?
Here is my simple program to test. -
#include <string.h>
-
-
int main (int argc, char** argv)
-
{
-
char* p1 = "Hello \'World\'";
-
char* p2 = "Hello 'World'";
-
int result = 0;
-
-
result = strcmp(p1, p2);
-
-
return 0;
-
}
-
thanks in advance,
George 10 1781
In article <e8************ *************** *******@a39g200 0pre.googlegrou ps.com>,
George2 <ge************ *@yahoo.comwrot e:
>I am surprised to see that the value of sign ' is the same as \'. So, there is no need to add sign \ before sign '?
There's no need to put a backslash before a single quote in a string,
but in a character constant you need it:
char *s = "'";
char c = '\'';
Conversely you need a backslash before a double quote in a string, but
not in a character constant:
char *s = "\"";
char c = '"';
You are allowed to use the backslashed forms even when not necessary.
-- Richard
--
"Considerat ion shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
George2 wrote:
Hello everyone,
I am surprised to see that the value of sign ' is the same as \'. So,
there is no need to add sign \ before sign '? In my past knowledge of
sign ', we always need to add sign \ before sign '. Any comments?
This snippet
char ch = 'a';
printf ("It's Jon%cs\n", ch);
.... prints "It's Jonas". Your mission, should you choose to
accept it, is to change the first line to make the output be
"It's Jon's".
--
Eric Sosman es*****@ieee-dot-org.invalid
Eric Sosman wrote:
George2 wrote:
>Hello everyone,
I am surprised to see that the value of sign ' is the same as \'. So, there is no need to add sign \ before sign '? In my past knowledge of sign ', we always need to add sign \ before sign '. Any comments?
This snippet
char ch = 'a';
printf ("It's Jon%cs\n", ch);
... prints "It's Jonas". Your mission, should you choose to
accept it, is to change the first line to make the output be
"It's Jon's".
How do you propose to make your posting self-destruct?
Mark Bluemel wrote:
Eric Sosman wrote:
>George2 wrote:
>>Hello everyone,
I am surprised to see that the value of sign ' is the same as \'. So, there is no need to add sign \ before sign '? In my past knowledge of sign ', we always need to add sign \ before sign '. Any comments?
This snippet
char ch = 'a'; printf ("It's Jon%cs\n", ch);
... prints "It's Jonas". Your mission, should you choose to accept it, is to change the first line to make the output be "It's Jon's".
How do you propose to make your posting self-destruct?
Unnecessary; I'll just deny all knowledge.
--
Eric Sosman es*****@ieee-dot-org.invalid
"George2" <ge************ *@yahoo.comwrot e in message
news:e8******** *************** ***********@a39 g2000pre.google groups.com...
Hello everyone,
I am surprised to see that the value of sign ' is the same as \'. So,
there is no need to add sign \ before sign '? In my past knowledge of
sign ', we always need to add sign \ before sign '. Any comments?
Here is my simple program to test.
-
#include <string.h>
-
int main (int argc, char** argv)
-
{
-
char* p1 = "Hello \'World\'";
-
char* p2 = "Hello 'World'";
-
int result = 0;
-
result = strcmp(p1, p2);
-
return 0;
-
}
-
Context, context, context.
char c = '\''; /* apostrophe in character literal */
char *s = "'"; /* apostrophe in string literal */
char c = '"'; /* quote in character literal */
char *s = "\""; /* quote in string literal */
char c = '''; /* invalid */
char *s = """; /* invalid */
-Mike
Eric Sosman wrote:
George2 wrote:
>Hello everyone,
I am surprised to see that the value of sign ' is the same as \'. So, there is no need to add sign \ before sign '? In my past knowledge of sign ', we always need to add sign \ before sign '. Any comments?
This snippet
char ch = 'a';
printf ("It's Jon%cs\n", ch);
... prints "It's Jonas". Your mission, should you choose to
accept it, is to change the first line to make the output be
"It's Jon's".
char ch = '\'';
--
Joe Wright
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
"Mike Wahler" <mk******@mkwah ler.neta écrit dans le message de news: 13************* @corp.supernews .com...
>
"George2" <ge************ *@yahoo.comwrot e in message
news:e8******** *************** ***********@a39 g2000pre.google groups.com...
>Hello everyone,
I am surprised to see that the value of sign ' is the same as \'. So, there is no need to add sign \ before sign '? In my past knowledge of sign ', we always need to add sign \ before sign '. Any comments?
Here is my simple program to test.
- #include <string.h>
- int main (int argc, char** argv)
- {
- char* p1 = "Hello \'World\'";
- char* p2 = "Hello 'World'";
- int result = 0;
- result = strcmp(p1, p2);
- return 0;
- }
Context, context, context.
char c = '\''; /* apostrophe in character literal */
char *s = "'"; /* apostrophe in string literal */
char c = '"'; /* quote in character literal */
char *s = "\""; /* quote in string literal */
char c = '''; /* invalid */
char *s = """; /* invalid */
Since you cannot have an empty character constant, ''' is not ambiguous, so
it could be allowed.
For the OP: now that you understand quoting issues better, how does C handle
triple quoting à la python:
char *s3 = """'""";
And what is wrong with these:
char c2 = '""';
char c3 = '"""';
--
Chqrlie.
Charlie Gordon wrote:
....
And what is wrong with these:
char c2 = '""';
char c3 = '"""';
Nothing, as far as I can see, though the value stored in c2 and c3 is
implementation-defined.
Charlie Gordon wrote:
[...]
Since you cannot have an empty character constant, ''' is not ambiguous, so
it could be allowed.
int ch = ''' + ''';
What value do you suggest ch should have? Twice the
value of '\'', or the implementation-defined value of a
character literal containing seven characters, or something
else?
--
Eric Sosman es*****@ieee-dot-org.invalid This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: cooldv |
last post by:
i know how to replace the sign " when SUBMITTING a form in asp by this
code:
message = Replace(usermessage, "'", "''").
My problem is DISPLAYING data in an asp FORM, from an an access
database, when the data already contains a " sign
problem is like this:
access database .... to update on the internet .... a *dataupdate.asp*
page ..... On this page, the data gets displayed in a form where i
|
by: tarmat |
last post by:
sorry for this silly little question, but whats the function to grab
the sign of a value?
|
by: Claude Gagnon |
last post by:
Hi,
How can we compare sign of numbers in C++ ?
Bye,
Claude
|
by: Sona |
last post by:
Hi,
Could someone please explain what sign-extension means? If I have a hex
number 0x55, how does this get sign-extended? Can a sign-extended
counterpart be equal to -91? In a program I'm expecting 0x55 in return
from a function whereas I am getting -91 every time.. does this mean
anything? Thanks
Sona
|
by: Jimmy |
last post by:
I'm trying to find a website that does the following:
1. Signs you up to a second site under a different primary domain (i.e.
as a result of a checkout or something). The username and password may
be automatically generated.
2. Signs on for you and redirects you to the second site without the
need of you signing up or signing in
I can't find an example of such a site. Do you know any?
Thanks,
| |
by: Steve K. |
last post by:
I recall a few months ago coming across an article allowing for encoding
(or converting?) xml and html documents into sign language as well as
brail for deaf and blind people, and that they were pending an ISO
designations.
I cannot seem to find any information on this. From what I recall they
were supposed to be use able in <metacharset or so tags.
Thanks in advance for any help on this.
|
by: =?ISO-8859-1?Q?Konrad_M=FChler?= |
last post by:
Hi,
a simple question:
Which standard function in c++ gives me the sign of a number?
Thanks
Konrad
|
by: Terry Chapman |
last post by:
I have a 2003 Access .mda add-in which I can sign using my Thawte digital
certificate.
I am now migrating this add-in to Access 2007 and when I try to add my
Thawte digital signature Access 2007 says 'Cannot save the digital signature
at this time' and suggests that I 'package and sign' the file from the
Microsoft Office Button / Publish / Publish and Sign menu option. I am able
to do this but it saves my add-in as a signed package...
|
by: Nick |
last post by:
I've seen a few frameworks use the following:
function $(id) { return document.getElementById(id); }
Then to use:
$('something').innerHTML = 'blah';
I'm just trying to roll this out to my site and so far doing this has
saved about 8KB of javascript (lots of ajax/dynamic elements). I just
|
by: Ravikiran |
last post by:
Hi Friends,
I wanted know about whatt is ment by zero optimization and
sign optimization and its differences....
Thank you...
|
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...
| |
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,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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,...
|
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...
|
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();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |