Hopefully this material is review for you. However, for those that didn't learn it the first time around, these are some important terms that you must understand. Note that memorization is not enough; if you do not understand these terms, then more advanced material will be inaccessible. They relate to high level language programming.
In essence, a symbol standing in for an unknown quantity.
See this Wikipedia link. Also see the section within this article called "Scope and extent" to help you understand the term scope.
In essence, a declaration specifies a variable or function's type and the identifier that goes with it.
See this Wikipedia link. The first paragraph is the real definition that we are after for the purposes of this class.
When a variable (or function) comes into being or exists in a running program.
In essence, for a programming language, describes when and where something such as a variable can be seen (referred to).
See this Wikipedia link.
The GNU C Programming Tutorial has some good prose describing scope.
Giving a variable an initial value.
This may seem trivial, but the term is included in this list, as a students who learn Java as their first high level language do not often realize that an instantiation of a variable does not imply initialization.
In the C programming language, neither a declaration nor an instantiation imply that a variable has been or will be given an initial value. No initialization? The variable takes on the value of whatever the bits in memory are at the location where that variable resides.
A compiler is a program that translates high level language code into assembly language code. Compilation is the act of compiling.
The time during which a program is being executed.
The machine code for a program, usually in a file with a format specific to the operating system, such that the program could be executed.
In essence, to cause something to run (execute). A program can be invoked, as can a function. At run time, an invocation of a function is known as a function call, and it causes the function to be executed.
The 3 separate concepts of declaration, instantiation, and initialization are generally rolled up into a single statement in Java programs. For example, the statement
ObjectType myObject = new ObjectType(12);
does all 3:
myObject, and it specifies the type as
of the ObjectType class.
new operator
instantiates the object.
In a C program, Karen suggests that you separate the declaration from the initialization in order to cement the distinct nature of these concepts. So, the declaration of a local variable within a function is given in this example in bold, and the initialization is italicized.
int myFunction() {
int count; /* declaration */
count = 12; /* initialization */
}
In addition, we rarely (never, in this class) want the scope of a local variable to be anything other than that of the invoked function, so we declare these local variables at the top of, but inside the function's definition.
| Copyright © Karen Miller, 2011 |