home *** CD-ROM | disk | FTP | other *** search
- //: C03:Declare.cpp
- // From Thinking in C++, 2nd Edition
- // Available at http://www.BruceEckel.com
- // (c) Bruce Eckel 1999
- // Copyright notice in Copyright.txt
- // Declaration & definition examples
- extern int i; // Declaration without definition
- extern float f(float); // Function declaration
-
- float b; // Declaration & definition
- float f(float a) { // Definition
- return a + 1.0;
- }
-
- int i; // Definition
- int h(int x) { // Declaration & definition
- return x + 1;
- }
-
- int main() {
- b = 1.0;
- i = 2;
- f(b);
- h(i);
- } ///:~
-