Chapter 7: Declarations, Definitions, and Initializations


OVERVIEW

Before an identifier can be used, it must first be declared in both C++ and Java. Declaring an identifier is not the samething as defining an identifier. An identifier is not defined until an appropriate amount of memory is allocated for the identifier. And then, when an identifier is the name of a variable, there is also the issue of whether or not the variable will get default-initialized when it is defined.

Initially focusing mostly on variables, this chapter starts with a discussion of when the declaration of a variable also constitutes its definition. This will be followed by the issue of default initialization of variables. The question we will answer there is: If you declare a variable and its declaration also constitutes its definition, is the variable given a default initialization?

Subsequently, we will talk about the scope of an identifier in a computer program. This will be followed by the issues of declaration, definition, and initialization of arrays in C++ and Java.




Programming With Objects[c] A Comparative Presentation of Object-Oriented Programming With C++ and Java
Programming with Objects: A Comparative Presentation of Object Oriented Programming with C++ and Java
ISBN: 0471268526
EAN: 2147483647
Year: 2005
Pages: 273
Authors: Avinash Kak

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net