Click to see the rest of the programming section :
One of the fundamentals of understanding how program code works is understanding the use of data types when declaring variables.
You may also see the term data types used when discussing databases, and it’s important to remember that some of the names for data types differ between the two topics.
In programming theory, there are five major data types that you will need to be able to identify and use in your programs:
A char is a single character. Characters can be alphabetical, numeric, or symbols and are generally from the ASCII character set (or Unicode for more complex programs).
Using a char data type is useful when each character of a word or phrase needs to be checked. For example when calculating the strength of a password, or checking that an email address meets the required pattern.
A string is a combination of characters in a word or phrase. In some older programming languages strings are declared as arrays of characters. Strings are one of the most common data types in programming and for some languages, all user input is initially treated as a string.
String manipulation is the process of analysing or changing string variables and is a large part of the programming topic.
You may recognise the term integer from your maths lessons, and in Computer Science it means exactly the same thing – data that is a whole number. When asked to define an integer in your exam, it is important to clearly state that the number is whole as just stating number is not specific enough.
A real number is the technical term for a decimal number in Computer Science. You may have seen them referred to as a float in programming languages – this is also a correct term in many languages.
Real numbers often need to be rounded or truncated (cut off) before they are output to the screen as a real number may contain an infinate number of numbers after the decimal point.
A boolean data type holds either a True or False value. The unusual name comes from the British mathematician, George Boole who developed the concept of reducing all logic down to a simple true or false value.
You’ll come across this in action in the Boolean Logic topic.
More For Members
Sign Up For Membership Today
|Individual Teacher||£3.99 per Month. After your initial payment, your first payment is Free.||Select|
|Individual Student||£2.50 per Month. After your initial payment, your first payment is Free.||Select|
|Whole School||£12.50 per Month.||Select|
|iGCSE Computer Science Distance Learning (Feb Start)||£21.00 now and then £21.00 per Month for 15 more Months.||Select|
|iGCSE Computer Science Distance Learning (Sept Start)||£21.00 now and then £21.00 per Month for 15 more Months.||Select|