Data Types

Today I have learn't about different data types which are used in computer programming. There are many data types that are used in different situation when storing data. For example one of them is a Boolean which have a memory size of 1 bit and it doesn't take too much of storage as it is a statement, True or False. It is the smallest data type that can be chosen to use, however it is mostly used to check the state of something.
Next data type is an Integer which has a memory size of 2 Bytes (sometimes 4). The integer could be used when storing how many lives someone has in a game. The integer stores positive or negative whole numbers, when using an integer you have to make sure there are no decimal points involve in your data that you're going to store. For example, numbers -33,485 to 33,487 = 2 bytes
Next data type is a Real which is a float or double. This data memory size could be the same as an integer, however mostly it has the biggest memory size out of all data types. This data type uses a Pie=3.142 to calculate any data that is going to be stored. The max number that we can get is a 2,147,483,647.
Next data type is a character which has a memory size of 2 bytes. A character stores a string of letters or symbols. For example it can store data that includes any names.
Also last data type is a string, which is mostly used when programming. The memory size of this data type is a length of your data to store * character memory size. For example "Mikolaj"* Character memory size (2 Bytes) =16 bytes. This number is quite small, however when on Facebook there are many users that store their names it can get to quite big numbers.

It is really important that you store your data with efficiency, which means that you store your data using least amount of your storage space to make it work faster and better quality. However you have to make sure it won't have any impact on performance when using it. Overall it will result in lower cost of everything as it will take less use of everything.
Also you have to make sure that all of the calculations are accurate as it could lead to ruining all of the programming. When calculating, make sure to use as much numbers as you are able to without rounding something down to be as much accurate as you can.
Also a speed of it is really important, to make sure it will work faster without losing any performance, you need to be trying to use lower memory sizes of data types to make it work faster but make sure to consider performance of it as well.
Also you need to make sure you are choosing a right data type as you could save more storage space using a different one. For example if you have a map with loads of squares, the squares might be 3.65 and you would use a Real data type, however they could be 3 which is a whole number so you could use an integer to save storage space.

Comments