Thread: representing constants of different type

  1. #1
    Registered User
    Join Date
    Feb 2009
    Posts
    9

    representing constants of different type

    we represent float type constant in this way
    12.23f

    here f is used for this.

    how to represent constant of type

    int, double, character, long, unsigned long, unsigned int, long double etc...??

    I tried to search it but didn't found the right match anywhere.


    waiting for your reply

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    int and double have no suffixes. You should have encountered character constants like 'a' before, but note that they are of type int. The unsigned suffix is u or U, while the long suffix is l or L, and the long long suffix is ll or LL. The long double suffix is also l or L.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Beginner Needs help in Dev-C++
    By Korrupt Lawz in forum C++ Programming
    Replies: 20
    Last Post: 09-28-2010, 01:17 AM
  2. Replies: 0
    Last Post: 03-20-2008, 07:59 AM
  3. Little Array Difficulty
    By G4B3 in forum C Programming
    Replies: 16
    Last Post: 03-19-2008, 12:59 AM
  4. scanf oddities
    By robwhit in forum C Programming
    Replies: 5
    Last Post: 09-22-2007, 01:03 AM
  5. gcc problem
    By bjdea1 in forum Linux Programming
    Replies: 13
    Last Post: 04-29-2002, 06:51 PM