+ 1

What is data types?

24th Aug 2016, 2:33 PM
Muhammed cp
Muhammed cp - avatar
8 Antworten
+ 3
It is the type of the variable or constant you use And it very important because before using any variable you should declare it first and to do that you need to specify its type first and there is six of them Int: for integer number and it is number without decimal point like -15, -6 , 4 , 5 , 1 Double: for number with two numbers after the decimal point lime 10.13, -45.67, 6.00, 1.00 Float: for the real full number with all the numbers after the decimal point ( a large version of double) Those three are just to declare data that are numbers Now to the other three String: is the data that are a sequence if character like a phrase or a word ( can include anything from numbers symbol and letters ) and it is always put inside " " for example: "this a chain of character" Char: is the data that are made of one letter or symbol and there is a limited number of them and they should be put between ' ' to be a char for example: 'c', '1' , Bool: this type only define the data that can only take two value true or false ( sometimes we use 1 instead of true and 0 instead of false) The type of data could effect totally the result of the program for example the variable 13.89729 we be treated as 13 if its type is int and 13.89 if it is double and 13.89729 if its float But in the other hand int uses less bite which means less space in the memory which means faster than double or float So you should chose depending on what you want Also for example the number 1 If it is writing this way :1 its type is int If it is writhing this way: '1' its type is char Also for example 234 If it is writing this way : 234 its type is int And if it is this way : "233" its type is string
24th Aug 2016, 3:46 PM
Raizel TheNoblesse
Raizel TheNoblesse - avatar
+ 3
@Raizel TheNoblesse Other way round😉 double is a more precise float, not a float is a more precise double. Great answer!
24th Aug 2016, 4:24 PM
Cohen Creber
Cohen Creber - avatar
+ 2
Data type is a classification of various types of data . such as integer, float
24th Aug 2016, 3:43 PM
Ansari Alfia
Ansari Alfia - avatar
+ 2
Thank you And that is true :3 you can it that way
24th Aug 2016, 4:27 PM
Raizel TheNoblesse
Raizel TheNoblesse - avatar
+ 1
wrong dude....every variable is a name to piece of memory that you can work with it...so would be confuse to do certain action with variables if all data types are mixed...not needing to use them...so data type its what information you will store on the variable that you declare...if the DATA TYPE is the type int you will work with whole numbers...so you can only store whole numbers in that variable because his data type its to store whole numbers....hope that this helps ;-)
24th Aug 2016, 3:51 PM
Carlos Augusto Silva Gurgel
Carlos Augusto Silva Gurgel - avatar
+ 1
wrong dude....every variable is a name to piece of memory that you can work with it...so would be confuse to do certain action with variables if all data types are mixed...not needing to use them...so data type its what information you will store on the variable that you declare...if the DATA TYPE is the type int you will work with whole numbers...so you can only store whole numbers in that variable because his data type its to store whole numbers....hope that this helps ;-)
24th Aug 2016, 3:56 PM
Carlos Augusto Silva Gurgel
Carlos Augusto Silva Gurgel - avatar
0
tankx for answering
25th Aug 2016, 1:27 PM
Muhammed cp
Muhammed cp - avatar
0
thanks
18th Mar 2018, 11:02 AM
bharat kumar
bharat kumar - avatar