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 Site License
Topic Introduction Pages
Additional Revision Resources
Exam Question Walkthroughs
Discounted Group Lessons
£2.50 per Month. After your initial payment, your first payment is Free.
Whole School Site License (teacher access)
Up to 50 student accounts (£3 per student, per annum for additional students)
Online Topic Lesson Plans
Differentiated Homework Tasks
Monthly Bundle of Downloadable Resources
Discounted Live Lessons
£12.50 per Month.
|Number of courses||3||0|
|Getting Started with LESS|
|Improve Your CSS Workflow with SASS|
|Easy Zurb Foundation|
|GET IT NOW||GET IT NOW|
Find this page helpful? Share the love on your social media mentioning @TeachAllAboutIT and we’ll enter you in our monthly draw to win a gift voucher for any product on the site!