" " and ' '

This is a discussion on " " and ' ' within the C++ Programming forums, part of the General Programming Boards category; when do you use " " and when do you use ' '?...

  1. #1
    wierd guy bart's Avatar
    Join Date
    Aug 2001
    Posts
    87

    " " and ' '

    when do you use " " and when do you use ' '?

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145

    Answer

    use " " for strings and ' ' for single characters. Ie: 'A', '1', "Hello". Obs: '1' != 1 (the character 1 is NOT the number 1.
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    Sayeh
    Guest
    In some cases, you can actually use the ' ' (single quotes) to also define a string constant in a long... for example:


    unsigned long identTag;


    identTag = 'BLUE';

    ---

    It's a 32-bit hex number. you can't use it for more than 4 bytes.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21