oreilly.comSafari Books Online.Conferences.


AddThis Social Bookmark Button

Glossary for "The Double Life of Variables"

by Seth Roby

The bits of data that are given to a function to work with (it's input). During the function call, they are listed inside the parentheses. During the function definition, they are defined with types and names inside the parentheses.

Argument Passing

The term used for giving values to the arguments in a function you are calling. Expressions are always evaluated before being passed as arguments. For example, in:

myFunction(3+2, "Simon");

The arguments are being passed as 5 and the string "Simon".

Assignment Operator

The equals sign, one example of an operator. This takes everything to the operator's right until a semicolon, evaluates it, and sets the variable that is to the immediate left of the operator to that value.

Binary Operator

An operator that works with two operands, one on each side of it.

Binary Number

A number that can be written in binary (1s and 0s).


a one or a zero. A group of eight is a byte


A section of code between an opening curly brace '{' and a closing curly brace '}'. These can nest, so you can have a block inside another block. In general, a block can replace any line of code.

Boolean And

The binary operator '&&', which evaluates to TRUE if and only if both the conditions on either side of it evaluate to TRUE.

Boolean Or

The binary operator '||', which evaluates to TRUE if either of the conditions on either side of it evaluate to TRUE, or if both evaluate to TRUE.

Boolean Logic

The branch of logic that determines if statements are TRUE or FALSE. This duality of yes and no is very computer-savvy, being binary (only two values).

Boolean Value



The name that the developer tools give to compiling code.


a group of eight bits

C String

A type of string that is used often by C.


A type that represents one letter, number, or symbol that can be written with a keystroke.


In code, a part that is meant to be read only by humans, and not to have meaning to the compiler. Like whitespace, the compiler simply ignores comments, which lets you put anything you want in them.

Comparison Operator

A binary operator that compares its operands and evaluates to a boolean value.


Translating the code you wrote in a half-english, half-computerese code into full computerese, called 'machine code' that the computer understands and can run.


A program on the computer that translates your code into machine language. Does the compiling.

Compile Time

The time when the compiler is translating the code to machine language so that it can be run.

Compound Condition

A set of conditions joined by logical operators such as 'and', and 'or'.


In a conditional, determines if the conditional's block should be executed. In a loop, determines if the loop should begin another iteration or not.

Regardless, evaluates to a boolean value.


A construct that makes code happen only when certain conditions are met. if/then is such a construct, as is switch.


Data that could be in variables that is instead typed directly into your code. Numbers and strings are the most common variable types that are expressed as constants.

Conversion Specification

A special string that contains a percent character, then a letter or number that defines a type. Used in format strings to determine how to describe the output string.

Disclosure Triangle

A standard widget that no one ever knows the name of. The little triangle that accompanies folders to show if they are expanded (points down) or not (points right).

Decrement Operator

The operator '--', which when appended to an integer variable will decrease that variable's value by one.

Developer Tools

The programs that Apple makes available to developers so that they can program for the Macintosh. The primary developer tool in versions of Mac OS X up to Jaguar is Project Builder, and after that it became Xcode.


A message that the compiler will give you when you have code that does not compile. Unlike warnings, you cannot run your code if you have errors.

Errors are usually displayed by the developer tools in red.

Escape Sequence

A string used to represent characters not normally available as keystrokes. In C, these begin with a slash character, '\' and are followed by another character which distinguishes which character the sequence stands for. \n is a newline, \t is a tab. There are many more.

Equality Conditional

The operator '==', which evaluates to TRUE if the operands are equal. Not a single equal sign becuase that's used to assign values to variables.


To call all functions and substitute in all variable's values. This happens at run time.


Code is executed at run time.


A boolean value, the opposite of TRUE. 0 is read as FALSE. See also NO.

Flow of Control

The order in which code is executed. Can be changed with conditionals and loops.

Format String

A special type of string that describes a string, by including conversion specifications inside of it. Used by printf() and NSLog(), and many other functions.


A sections of code that can be called from other code. In C, you must declare the function before any code that calls it (or get a warning), and define the function somewhere in the code (or get an error).

Functions take inputs called arguments that can change how they work internally.

Functions have an associated block of code called the function body that defines the code that the function does.

Functions can return a value of any type to the code that calls it.

Note that functions have a distinction between declaration and definition, whereas a variable has none; declaration and definition are identical.

Function Call

A means by which one part of a program can call another part of a program. This makes it easy to use the same code over and over again, without having to rewrite it over and over again. Uses a syntax such as:

name(argument1, argument2)

where the function's name preceeds the parentheses, and all arguments are listed in the parentheses and separated by commas.

Function Body

The block of code in a function definition that defines the code that that function executes.

Function Declaration

A line of code that tells the compiler that a function exists, so that the compiler will not complain if you use that function. Has the form:

returnType functionName(argType argName1, argType argName2);

This can usually be copied and pasted from the functon definition.

Function Definition

Code that defines exactly what a function does. Has the form:

returnType functionName(argType argName1, argType argName2) {
	//function body

When the function is called, The arguments are implicitly defined in the function body, and take on the values passed into them by the function call.

Global Variable

A variable that is declared outside of any blocks of code, and therefore never passes out of scope. Can be accessed within any block of code, in any funtion. Contrast with local variables.

Greater-Than Operator (aka '>')

The binary operator '>', which evaluates to TRUE if the left operand is greater than the right operand.

Greater-Than or Equal-To Operator (aka '>=')

The binary operator '>=', which evaluates to TRUE if the left operand is greater than or equal to the right operand.


A name for the memory the program can use for it's own purposes. Does not include the stack or any code that is in memory.

The most common use for this memory is to declared variables in it. These variables can be said to be 'in the heap.' These variables exist outside of any scope, and can be said to be global, but they can only be accessed through pointers, which follow normal scope rules. It is important to free any memory allocated from the heap; failure to do so causes a memory leak.

Imperative Language

A programming language where the programmer tells the computer what to do in a specific order, one statement after another. C is such a language.

Infinite Loop

A loop whose condition is never FALSE, and so never ends.

Increment Operator

The operator '++', which when appended to an integer variable will increase that variable's value by one.


The information that goes into a function, program, etc. The opposite of output.


A type that represents a whole number, without any decimal part. Declared with the keyword int. 5, -23, and 17,000 are all integers, while 2.3, .9, and pi are not. An integer can optionally be unsigned, which means that it must be positive.


One pass through a loop. Begins with the evaluation of the condition. If the condition evaluates to TRUE, the code block is executed. In a for loop, also includes the evaluation of the step.

Less-Than Operator (aka '<')

The binary operator '<', which evaluates to TRUE if the left operand is less than the right operand.

Less-Than or Equal-To Operator (aka '<=')

The binary operator '<=', which evaluates to TRUE if the left operand is less or equal to than the right operand.

Line Number

A way of referencing a specific line of code. Line numbers always begin at the start of the file with the first line numbered one. You will often see line numbers in the format MyKeenFile.c:23, with the filename before the colon and the line number in that file after it. In the Developer Tools the line number is displayed at the top of any editor window in this format.

Local Variable

A variable that is declared inside a block of code, and exists only within that block of code and all blocks inside of that block, but not in any functions called from those blocks. Contrast with global variables.


A code construct that tells the computer to execute code a specific number of times. Each loop has a type to determine general behavior, a condition which determines how many times the loop should run, and a block of code. Executing the loop can be logically divided into a number of iterations, which check the condition and execute the code in the block if the condition is true.


A shorthand for doing complex tasks. For all intents and purposes, acts like a function.


A term used in computer science meaning that one thing can go inside another. Blocks can nest in that one block can go inside another.


A boolean value, the opposite of YES. 0 is read as NO. See also FALSE.


A token that has a special meaning to the compiler. Operators are the verbs of C, and they act on the other tokens around them.


The inputs for an operator.


The information that comes out of a function, program, etc. The opposite of input.


A type that represents an address to look for data in the heap. This allows the programmer to create larger variables (such as objects or memory-mapped files) and store them in a more persistent way, while only moving the much smaller pointer through the program. Pointers are usually obtained from functions being called (in C) or through methods being called (in Objective-C). It is important not to lose the pointer, as it is the only connection the programmer has to the data allocated in the heap. It is also important to free any memory allocated when you are done with it, or you will cause a memory leak.


The name Apple's Developer Tools gives to a program under development. When you create a project, the developer tools create a folder for any code files to live in, as well as a project file (which is really a package). Any support files will also go into this folder.

Project Builder

The primary Developer Tool for versions of Mac OS X up until Panther's release. Formerly known as ProjectBuilder (no space).


The act of a function giving its results to the code that called it. Every function returns the type of data it is defined to return. Use the command return to accomplish this. It is good practice, though not required, to have return on the last line of the returning function.

RISC Architecture

Reduced Instruction Set Computing. A design philosophy in computer chip making where the computer understands less instructions, but can do them faster and therefore gets the same amount of work done faster by breaking it down better. The opposite of CISC, Complex Instruction Set Computing. Macintoshes have been RISC based since the PowerPC debuted, whereas Intel and AMD chips have held onto their CISC roots while incorporating some RISC ideas.


Making your code do whatever it is your code does. Once the code is compiled, the computer can run the code like it runs any other application. You can even go into the terminal and launch the code.

Run Time

The time when the program is actually running, after all code has been compiled.


The lifetime of a variable. Any given variable exists only within a certain scope, defined by the block of code it is declared in. The variable exists in that block and in all sub-blocks, but not in any functions called in those blocks. If the variable is not declared in any block, it is a global variable, and can be said to have global scope. Otherwise, it is a local variable.


A section of code, usually when offered to someone. Can be a block, but doesn't have to be.


A section of memory that keeps track of the current runtime state the program is in by knowing what functions are currently being called, and in what order. Consists of an ordered list of Stack Frames, with the frame for the main function always being at the bottom of the stack and all other frames building up from there.

Stack Frame

An element on the stack that represents one function that is currently being executed. There is always a one-to-one correspondence betwen frames and functions. For any given frame 'F', the frame below it on the stack is the frame that represents the function that called the function frame F represents, and the frame above it on the stack represents a function that was called within the function F represents.

The frame stack contains a lot of information, amongst which is a list of variables that are declared within the frame's function. these variables can be said to be 'on the stack.' These variables are in scope within this function, but not in scope in functions above or below it on the stack.

Star Operator (aka '*')

An operator that, when prepended to a variable name, notifies the compiler that this variable should be trated as a pointer.


The action taken at the end of a loop to set up the next iteration of that loop, and possibly to clean up the current iteration. Without a step, you end up with an infinite loop.


A list of characters that make a bit of text.

Ternary Operator
An operator that operates on three operands. There is only one such operator, so it is often called 'the ternary operator', since 'the question-colon operator' sounds dumb.

In code, everything that is not whitespace is a token. Each section of text between sections of whitespace is a seperate token. This is a more general term than 'word', because an equal sign is also a token, but might not be counted as a word by some.


A boolean value, the opposite of FALSE. Anything other than 0 is read as TRUE. See also YES.


A way of interpreting data. Every variable has a type that tells the computer how to interpret the bits that the variable really represents. There are many different types defined in C, and the programmer can define his own types as well.


A section of memory that is set aside to hold some specific information. Variables are created with a variable definition, and afterwards are referenced by name, which much be one token. Every variable has a type assigned to it, to tell the computer how to read the variable.

Variable naming in C follows a standard that takes all the words in the name, capitalizes them, and takes out the spaces. The first letter is not capitalized. So a variable that represents the 'Number Of Doodads to Make' would be called 'numberOfDoodadsToMake'. Note that this is not a requirement, but it makes your code easier to understand to the rest of the world.

Varible Assignment

A line of code that assigns a value to an already-created variable.

Varible Declaration

A line of code that creates a variable with a specific name and type. It can be combined with a variable assignment in the same line.

Varible Definition

See variable declaration. Note that variables have no distinction between declaration and definition, becasue once a variable has a name and a type it is declared and defined, whereas a function must have separate declaration and definition.


A type that represents a lack of data. Functions returning void are called procedures in some languages, but C and derivatives use 'function' as a catch-all term.


A message that the compiler will give you when it detects something possibly wrong with your program. A warning is not definitely a problem, but it is a questionable bit of code and the compiler is telling you to watch out. Unlike errors, you can still run with code that makes warnings, but they may lead to errors or crashes in your code at run time.


Spaces, Tabs, and Returns are collectively referred to as whitespace. In code, whitespace is ignored by the compiler, and so can be used to deliniate sections of code, or make code more readable to people.


The primary developerer tool provided by Apple starting with Panther.


A boolean value, the opposite of NO. Anything other than 0 is read as YES. See also TRUE.

Return to "The Double Life of Variables"