Assign char variable with multi-character constant

Discussion in 'C Programming' started by saurabh29789, May 28, 2009.

  1. saurabh29789

    saurabh29789 Guest

    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.
     
    saurabh29789, May 28, 2009
    #1
    1. Advertising

  2. saurabh29789

    saurabh29789 Guest

    On May 28, 12:57 pm, Richard Heathfield <> 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 !!
     
    saurabh29789, May 28, 2009
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    8
    Views:
    440
    Alf P. Steinbach
    May 18, 2005
  2. mimmo
    Replies:
    4
    Views:
    28,101
  3. lovecreatesbeauty
    Replies:
    1
    Views:
    1,152
    Ian Collins
    May 9, 2006
  4. multi-character constant

    , Nov 21, 2007, in forum: C Programming
    Replies:
    11
    Views:
    3,006
    Willem
    Nov 22, 2007
  5. emeraldsky23

    warning: multi-character character constant error

    emeraldsky23, Jan 15, 2011, in forum: C Programming
    Replies:
    0
    Views:
    1,084
    emeraldsky23
    Jan 15, 2011
Loading...

Share This Page