title: Creating a global char pointer
body: <p>I'm programming (and indeed close to completing) a CLI program to test the user on vocabulary, or indeed any set of questions and responses he/she would care to define.</p>
  
  <p>Full source on github: <a href="https://github.com/megamasha/Vocab-Tester" rel="nofollow">https://github.com/megamasha/Vocab-Tester</a></p>
  
  <p>Loading from a file and saving to a file are handled from separate functions, both outside of main(). At the moment they're in the same source file, but I'd like to know how to do this both a) within the file, and b) in the case that they end up in a separate database ops file.</p>
  
  <p>I want to allow the user to save to the file he most recently loaded, so I want my <code>loaddatabase()</code> function to define a global char * to the filename, which the <code>savedatabase()</code> function can then access.</p>
  
  <p>If I declare a char * outside of any function, it is read-only and trying to write a filename to it causes a segfault.
  If I declare it within the  <code>loaddatabase()</code> function, <code>savedatabase()</code> can't access it.</p>
  
  <p>Will declaring the variable static allow other functions to access it, or if not, how can I allow two functions to access the same char *?</p>