title: Dereferencing a char pointer in C/C++?
body: <p>I am working in a program using the DWARF and ELF info. I am hooked to another program using a tool called Pin. I have the addresses from the global variables declared in "Y" program and I hook it into my Pin module which I will call "X". </p>
  
  <p>I am getting a bunch of addresses for these global variables. Unfortunately I am having troubles when I try to dereference them. For example (right now I am doing things manually to see if it is doing what is supposed to be doing):</p>
  
  <pre><code>char * limit, * address1;
  
  for(address1 = (char *) 0x804A040, limit = address1 + bytesize; address1 &lt; limit; address1++)
        cout &lt;&lt;  *(address1) &lt;&lt; "\n";
  </code></pre>
  
  <p>I should be getting the variable that is stored in that address which is a <code>char *</code> to a word. Do I have to dereference two pointers in this case? The address and then the <code>char *</code> stored in that address?</p>
  
  <p>This works perfectly fine when I want to dereference an <code>int</code> variable, but whenever I try to dereference a char pointer or variable I get <code>non-ASCII</code> values...</p>