home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Ebooks / Thinking in C++ V2 / C03 / Declare.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-25  |  551 b   |  26 lines

  1. //: C03:Declare.cpp
  2. // From Thinking in C++, 2nd Edition
  3. // Available at http://www.BruceEckel.com
  4. // (c) Bruce Eckel 1999
  5. // Copyright notice in Copyright.txt
  6. // Declaration & definition examples
  7. extern int i; // Declaration without definition
  8. extern float f(float); // Function declaration
  9.  
  10. float b;  // Declaration & definition
  11. float f(float a) {  // Definition
  12.   return a + 1.0;
  13. }
  14.  
  15. int i; // Definition
  16. int h(int x) { // Declaration & definition
  17.   return x + 1;
  18. }
  19.  
  20. int main() {
  21.   b = 1.0;
  22.   i = 2;
  23.   f(b);
  24.   h(i);
  25. } ///:~
  26.