title: C++ class with char pointers returning garbage
body: <p>I created a class "Entry" to handle Dictionary entries, but in my main(), I create the Entry() and try to cout the char typed public members, but I get garbage.  When I look at the Watch list in debugger, I see the values being set, but as soon as I access the values, there is garbage.  Can anyone elaborate on what I might be missing?</p>
  
  <pre><code>#include  &lt;iostream&gt;
  
  using  namespace  std;
  
  class Entry
  {
      public:
              Entry(const char *line);
              char *Word;
              char *Definition;
  };
  
  Entry::Entry(const char *line)
  {
      char tmp[100];
      strcpy(tmp, line);
  
      Word = strtok(tmp, ",") + '\0';
      Definition = strtok(0,",") + '\0';
  }
  
  int  main()
  {
      Entry *e = new Entry("drink,What you need after a long day's work");
      cout &lt;&lt; "Word: " &lt;&lt; e-&gt;Word &lt;&lt; endl;
      cout &lt;&lt; "Def: " &lt;&lt; e-&gt;Definition &lt;&lt; endl;
      cout &lt;&lt; endl;
  
      delete e;
      e = 0;
  
      return  0;
  }
  </code></pre>