- 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:
No | Data Type | Full form | Range of Values |
---|---|---|---|
1 | char | Character | -128 to 127 |
2 | int | Integer | -32768 to +32767 |
3 | float | single precision floating point | 3.4e-38 to 3.4e+38 |
4 | double | Double precision floating point | 1.7e-308 to 1.7e+308 |
5 | void | Void |
- 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
No | Data Type | Qualifier |
---|---|---|
1 | char | Signed,Unsigned |
2 | int | short,long,signed,unsigned |
3 | float | No qualifier |
4 | double | long |
5 | void | No 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 Type | 16 bit machine | 32 bit machine | ||
---|---|---|---|---|
size(bytes) | Range | Size(bytes) | Range | |
Char or Signed Char | 1 | -128 to 127 | 1 | -128 to 127 |
Unsigned Char | 1 | 0 to 255 | 1 | 0 to 255 |
Short int or Signed short int | 1 | -128 to 127 | 2 | -32768 to 32767 |
unsigned short int | 1 | 0 to 255 | 2 | 0 to 65535 |
int or Signed int | 2 | -32768 to 32767 | 4 | -2147483648 to 2147483647 |
Unsigned int | 2 | 0 to 65535 | 4 | 0 to 4294967295 |
Long int or Signed long int | 4 | -2147483648 to 2147483647 | 4 | -2147483648 to 2147483647 |
Unsigned long int | 4 | 0 to 4294967295 | 4 | 0 to 4294967295 |
Float | 4 | 3.4e-38 to 3.4e+38 | 4 | 3.4e-38 to 3.4e+38 |
Double | 8 | 1.7e-308 to 1.7e+308 | 8 | 1.7e-308 to 1.7e+308 |
Long Double | 10 | 3.4e-4932 to 3.4e+4932 | 16 |
- 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.
long=long int
Short int x; can be wriiten as short x;
- signed and unsigned can also be used alone as type specifiers.
unsigned int=unsigned
unsigned int x; can be wriiten as unsigned x;
Hi,
ReplyDeleteVery good coverage of the Enum.
Please give some more examples where enum/unions/function pointers can be used in real world problems.
This is a great blog..! Thanks for your efforts and time spent..
ReplyDeleteYou can also find some material here
good one.
ReplyDeleteVery nice Explanations
ReplyDeleteIt is in point of fact a great and useful piece of information.
ReplyDeleteI 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
hello!,I love your writing so a lot! proportion we
ReplyDeletekeep 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
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.
ReplyDeleteI'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
I pay a visit each day a few blogs and information sites to read articles, however this web site presents feature based
ReplyDeletecontent.
Check out my blog :: visit url
Excellent beat ! I wish to apprentice whilst you amend
ReplyDeleteyour 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
Article writing is also a excitement, if you know afterward you can write
ReplyDeleteor else it is difficult to write.
Feel free to surf to my webpage; website link
You could certainly see your expertise in the work you write.
ReplyDeleteThe 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
You really make it seem so easy with your presentation but I find this matter to be really something that
ReplyDeleteI 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
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.
ReplyDeleteP.S Sorry for being off-topic but I had to ask!
My blog - Visit website
Attractive section of content. I just stumbled upon your site and in accession
ReplyDeletecapital 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
A person necessarily lend a hand to make significantly posts I
ReplyDeletemight 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
Awesome article.
ReplyDeleteVisit my blog post ... website
Hey! I just wanted to ask if you ever have any issues with hackers?
ReplyDeleteMy 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
Thank you for the good writeup. It in fact was a amusement account it.
ReplyDeleteLook advanced to more added agreeable from you! By the way, how
can we communicate?
Also visit my homepage :: houses on auction
You ought to take part in a contest for one
ReplyDeleteof the most useful sites on the web. I'm going to recommend this site!
my site; professional accounting
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.
ReplyDeleteMy site: wedding photography Cape Town
I have been browsing online greater than three hours these days, yet I
ReplyDeletenever 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
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
ReplyDeleteincredibly 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
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.
ReplyDeleteAlso visit my blog post :: more info