title: Global variables in visual c++
body: <p>I've been working on this issue for awhile now.  I"m just looking to pass a one character value from one class to another </p>
  
  <p>In my header file I have a variable declared:</p>
  
  <pre><code>  extern char variable1;
  </code></pre>
  
  <p>in class1.cpp i have the same variable declared:</p>
  
  <pre><code>char variable1 = 'N';  
  </code></pre>
  
  <p>in class2.cpp i have the same variable declared: I don't initialize this due to the logic required for the Y/N is in class1.cpp</p>
  
  <pre><code>  char variable1;
  </code></pre>
  
  <p>My assumption on how this would work is that I would go through the logic to set it to a Y or keep it an N as initizlied in class1, once the function is finished, I would click the button on the form to go to the next class and since they all have the same name and the file name is in the header file with the keyword extern it would pass the values back and forth, is my thinking wrong?  I'm still new to visual c++ so i'm just trying to learn.</p>