Table Of Contents
Previous Section Next Section

Program 11: Two Files Is Too Many

This is another way of doing "Hello World" and screwing up. What's happening?

File: sub.cpp

  1 // The string to print
  2 char str[] = "Hello World!\n";

File: main.cpp

  1 /************************************************
  2  * print string -- Print a simple string.       *
  3  ************************************************/
  4 #include <iostream>
  5
  6 extern char *str;       // The string to print
  7
  8 int main()
  9 {
 10     std::cout << str << std::endl;
 11     return (0);
 12 }

(Next Hint 269. Answer 7.)

Table Of Contents
Previous Section Next Section