Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Assign char variable with multi-character constant

Reply
Thread Tools

Assign char variable with multi-character constant

 
 
saurabh29789
Guest
Posts: n/a
 
      05-28-2009
Consider the following statement :

char ch='87';

Is this behavior defined? If yes, then what is that behavior? and if
no, then what does the standard say about the same?

I searched the C99 but couldn't find any clause pertaining to it.
 
Reply With Quote
 
 
 
 
saurabh29789
Guest
Posts: n/a
 
      05-28-2009


On May 28, 12:57*pm, Richard Heathfield <(E-Mail Removed)> wrote:
> saurabh29789 said:
>
> > Consider the following statement :

>
> > char ch='87';

>
> > Is this behavior defined?

>
> Yes, it's implementation-defined.
>
> > If yes, then what is that behavior?

>
> Implementation-defined. Consult your documentation.
>
> > and if no, then what does the standard say about the same?

>
> > I searched the C99 but couldn't find any clause pertaining to it.

>
> C99 6.4.4.4(10): "The value of an integer character constant
> containing more than one character (e.g., 'ab'), or containing a
> character or escape sequence that does not map to a single-byte
> execution character, is implementation-defined."
>
> --
> Richard Heathfield <http://www.cpax.org.uk>
> Email: -http://www. +rjh@
> Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
> "Usenet is a strange place" - dmr 29 July 1999




Thanks !!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
(const char *cp) and (char *p) are consistent type, (const char **cpp) and (char **pp) are not consistent lovecreatesbeauty C Programming 1 05-09-2006 08:01 AM
/usr/bin/ld: ../../dist/lib/libjsdombase_s.a(BlockGrouper.o)(.text+0x98): unresolvable relocation against symbol `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostre silverburgh.meryl@gmail.com C++ 3 03-09-2006 12:14 AM
Identifying char * vs char[CONSTANT] eyal.susser@gmail.com C++ 8 05-17-2005 11:40 PM
The difference between char a[6] and char *p=new char[6] ? wwj C Programming 24 11-07-2003 05:27 PM
the difference between char a[6] and char *p=new char[6] . wwj C++ 7 11-05-2003 12:59 AM



Advertisments