+ 3
what is data type mean in simplest form ? please help I am beginner
is data type just store and shape a variable(s) ?
6 Réponses
+ 15
A data type is what tells the computer how to store and display information, and how much space it needs to store it. This is because not all data needs the same amount of space, and all data, even text, is stored as numbers in a computer.
Ex: The character '9' (used as text, not for math) is actually 57 in ASCII encoding, and is stored as 57, plus some data saying "this is a character", so it prints 9 instead of 57.
Which is different from 9 as an integer, which is literally stored as 9, plus data that says "this is a whole number", so it uses 9 as a number that cannot have decimals.
+ 10
Data type describes how the data should be treated. In some programming languages, you have to declare the data type like in c++ , in some advanced languages the data can be treated as many types without entering data type intially.
+ 6
[EDIT] A glass with liquid seems better :D
A variable can be thought of as a glass, where you can pour some liquid. The glass has a certain shape.
The shape of the glass is the data type, or how the computer should interpret the data inside of it.
At one of the lowest levels, everything is bytes. You see numbers and strings because you tell the program "what is inside this glass is a string", so it can take it in chuncks and tell the characters apart. If it were read as a number, the way it handles it would be different.
+ 4
Every value which you algorithm uses must be stored in a variable.Each variable needs to be defined as one of supported datatypes offered by c++.Differen programing language has very similar datatypes.Datatypes specifies i.e. max range of values you can store into. Different datatypes take different amount of physical memory used for them.Simply sad it is differen if you want to store value=1 and value=65535,it can takes different amount of memory.
+ 1
simply sad yes.But not only store and shape, operations and comparisons as well. I.E boolean yesno = true; float percentage = 6.8; So,it is nonsence to compare yesno and percentage each other.
0
is data type just store and shape a variable(s) ?