The greatest mistake you can make in life is to be continually fearing you will make one

Tuesday 23 February 2010

C Data Types and Sizes

  • In a C program, the programmer has to tell the system before, the type of numbers or characters he is using in his program. These specification of data is called data type.
  • C language data types can be classified in to 3 types as shown in figure

Primary Data type:

NoData TypeFull formRange of Values
1charCharacter-128 to 127
2intInteger-32768 to +32767
3floatsingle precision floating point3.4e-38 to 3.4e+38
4doubleDouble precision floating point1.7e-308 to 1.7e+308
  • void data type used in functions to specify the return value or the arguments.
  • There are number of qualifiers such as short,long,signed,unsigned can be applied to these primary data types.
  • The possible qualifiers for the basic type are shown in the table
NoData TypeQualifier
3floatNo qualifier
5voidNo qualifier

  • Each compiler is free to choose appropriate size for its own hardware with restrictions that short and int are atleast 16 bits and longs are atleast 32 bits and size of short < int < long.
  • qualifier signed or unsigned may be applied to char or any integer.
  • unsigned numbers are always positive or zero and obey the laws of arithmetic modulo 2n, where n is the number of bits in the type.For example char is 8 bits so unsigned char variables have values between 0 and 28 ie values between 0 and 255.
Data Type16 bit machine32 bit machine
Char or Signed Char1-128 to 1271-128 to 127
Unsigned Char10 to 25510 to 255
Short int or Signed short int1-128 to 1272-32768 to 32767
unsigned short int10 to 25520 to 65535
int or Signed int2-32768 to 327674-2147483648 to 2147483647
Unsigned int20 to 6553540 to 4294967295
Long int or Signed long int4-2147483648 to 21474836474-2147483648 to 2147483647
Unsigned long int40 to 429496729540 to 4294967295
Float43.4e-38 to 3.4e+3843.4e-38 to 3.4e+38
Double81.7e-308 to 1.7e+30881.7e-308 to 1.7e+308
Long Double103.4e-4932 to 3.4e+493216

  • If we do not specify either signed or unsigned, most compiler will assume the type to be signed.           so signed int x; can be written as int x;
  • short and long can be used alone as type specifiers. 
            short=short int
            long=long int
            Short int x; can be wriiten as short x;

  • signed and unsigned can also be used alone as type specifiers. 
            signed int=signed
            unsigned int=unsigned
            unsigned  int x; can be wriiten as unsigned x;


  1. Hi,
    Very good coverage of the Enum.

    Please give some more examples where enum/unions/function pointers can be used in real world problems.

  2. This is a great blog..! Thanks for your efforts and time spent..

    You can also find some material here

  3. It is in point of fact a great and useful piece of information.
    I am glad that you just shared this helpful info with us.
    Please keep us informed like this. Thanks for sharing.

    my web blog: website link

  4. hello!,I love your writing so a lot! proportion we
    keep up a correspondence extra approximately your post
    on AOL? I need an expert in this area to resolve my problem.

    May be that is you! Taking a look ahead to peer you.

    Feel free to visit my webpage ... networking Kwazulu Natal

  5. Greetings from Idaho! I'm bored to tears at work so I decided to check out your site on my iphone during lunch break. I enjoy the information you provide here and can't wait to take a look when I get home.
    I'm shocked at how fast your blog loaded on my phone .. I'm not even
    using WIFI, just 3G .. Anyways, very good site!

    Take a look at my web site :: website link

  6. I pay a visit each day a few blogs and information sites to read articles, however this web site presents feature based

    Check out my blog :: visit url

  7. Excellent beat ! I wish to apprentice whilst you amend
    your website, how could i subscribe for a weblog site? The account helped
    me a acceptable deal. I had been tiny bit acquainted of this your broadcast offered brilliant
    transparent idea

    My web blog More Info

  8. Article writing is also a excitement, if you know afterward you can write
    or else it is difficult to write.

    Feel free to surf to my webpage; website link

  9. You could certainly see your expertise in the work you write.
    The sector hopes for even more passionate writers like you who are not afraid to mention how
    they believe. All the time go after your heart.

    My web-site click url

  10. You really make it seem so easy with your presentation but I find this matter to be really something that
    I think I would never understand. It seems too complex and very broad for
    me. I'm looking forward for your next post, I'll try to get the hang of it!

    Feel free to surf to my website: visit url

  11. Hello would you mind sharing which blog platform you're using? I'm looking to start my own blog in the near future but I'm having a tough time making a decision between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your design seems different then most blogs and I'm looking for something completely unique.
    P.S Sorry for being off-topic but I had to ask!

    My blog - Visit website

  12. Attractive section of content. I just stumbled upon your site and in accession
    capital to assert that I acquire actually enjoyed account your blog posts.
    Any way I'll be subscribing to your feeds and even I achievement you access consistently fast.

    Here is my web page: click Here

  13. A person necessarily lend a hand to make significantly posts I
    might state. That is the very first time I frequented your web page and to this point?
    I amazed with the analysis you made to make this actual submit extraordinary.

    Wonderful task!

    My webpage :: website Link

  14. Awesome article.

    Visit my blog post ... website

  15. Hey! I just wanted to ask if you ever have any issues with hackers?
    My last blog (wordpress) was hacked and I ended up losing several weeks
    of hard work due to no data backup. Do you have any solutions to protect against hackers?

    Stop by my homepage ... engine rebuilds KwaZulu Natal

  16. Thank you for the good writeup. It in fact was a amusement account it.
    Look advanced to more added agreeable from you! By the way, how
    can we communicate?

    Also visit my homepage :: houses on auction

  17. You ought to take part in a contest for one
    of the most useful sites on the web. I'm going to recommend this site!

    my site; professional accounting

  18. Hello, Neat post. There's a problem with your site in web explorer, may check this? IE still is the marketplace leader and a big element of folks will omit your great writing because of this problem.

    My site: wedding photography Cape Town

  19. I have been browsing online greater than three hours these days, yet I
    never discovered any fascinating article like
    yours. It is beautiful worth enough for me. Personally, if all website owners and bloggers made just right content
    as you probably did, the internet can be much more useful
    than ever before.

    Also visit my website dstv installations johannesburg

  20. I've been exploring for a bit for any high-quality articles or blog posts in this kind of space . Exploring in Yahoo I ultimately stumbled upon this site. Reading this information So i am satisfied to express that I've an
    incredibly just right uncanny feeling I came
    upon just what I needed. I so much undoubtedly will make sure to do
    not fail to remember this site and give it a glance on a continuing basis.

    Check out my homepage: customised art Johannesburg

  21. If some one desires expert view on the topic of running a blog afterward i propose him/her to pay a visit this blog, Keep up the nice work.

    Also visit my blog post :: more info