Objective-C 2.0 Data Types

From Techotopia
Revision as of 14:54, 30 September 2009 by Neil (Talk | contribs) (New page: When we look at the different types of software that runs of computer systems and smartphones from financial applications to graphics intensive games, it is easy to forget that computers a...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

When we look at the different types of software that runs of computer systems and smartphones from financial applications to graphics intensive games, it is easy to forget that computers are really just binary machines. Binary systems work in terms of 0 and 1, true or false, set and unset. All the data sitting in RAM, stored on disk drive and flowing through circuit boards and buses are nothing more than sequences of 1s and 0s.

Humans, of course, don't think in binary. We work with numbers, letters and words. In order for a human to easily (easily being a relative term in this context) program a computer some middle ground between human and computer thinking is needed. This is where programming languages such as Objective-C come into play. Programming languages allow us humans to express instructions to a computer in terms and structures we understand, and then compile it down to a format that can be executed by a computer.

One of the fundamentals of any program involves data, and programming languages such as Objective-C define a set of data types that allow us to work with data in a format we understand when writing a computer program. For example, if we want to store a number in an Objective-C program we could do so with the following syntax:

int mynumber = 10;

In the above example, we have created a variable named mynumber of data type integer by using the keyword int. We then assigned the value of 10 to this variable.