In this blog |
---|
Basic data types |
A simple eg |
small expl about void |
Types of data type...
1.) Basic data type
2.) Derived data type
3.) Enumerated data type
Basic data types
there are 5 basic data types in c
Data type | keyword used | Size in bytes | Range | Format specifier |
---|---|---|---|---|
Character | char | 1 | -128 to 127 | %c |
Integer | int | 4 | -2,147,483,648 to 2,147,483,647 | %d |
Floating point | float | 4 | 3.4E-38 to 3.4+38 | %f |
Double | double | 8 | 1.7E-308 to 1.7+308 | %lf |
Valueless | void | 0 | Value less | ~~ |
leaving this we are having many more data types with extensions :
1) unsigned ( +ve range only)
2) signed ( both +ve and -ve range)
3) long ( extended range )
4) short ( short range)
so what is the use of this extensions , usage are based on requirement ,for eg you want to store interger type of data but you dont need that much of space as that for basic integer so you can use short extension in order to save some space. to read more go to
(if you dont know about the scanf and printf ,they are just used for scaning the value from the user and printing the value on screen respectively,dont wory i will discuss that in later)
(note : format specifier %d in this case, will change according to the datatype,and the value 2 in this case should not be greater than range otherwise garbage value will gets diplayed)
explanation about void
void is data type mainly used for functions and pointer but not with variable (to know more about go to
)
(we will discuss that whole concept late on because it is out of range of our topic)
(leave the comment down below if you have a doubt or suggestions ,thnks🙂)
No comments:
Post a Comment