title: How to check out the values of dynamic allocated memory in debugging mode?
body: <p>i'm using eclipse and netbeans for c, and i'd like to check out the values of variables that are dynamically allocated in the memory when i'm debugging (both in <em>eclipse</em> and <em>netbeans</em>).</p>
  
  <p>for some reason, i can only see the value of the pointer itself, and it's first item.</p>
  
  <p>to illustrate: with this code:</p>
  
  <pre><code>int foo[10];
  </code></pre>
  
  <p>i can check the value of the entire array later on (when debugging).
  for example, i can check out the value of foo[7] in the watches window.</p>
  
  <p>but with this code:</p>
  
  <pre><code>int *bar = malloc(10*sizeof(int));
  </code></pre>
  
  <p>i can only check out where <code>bar</code> is pointing, and the value of <code>bar[0]</code> (but not the other values).</p>
  
  <p>how can i watch all the values of the array?</p>
  
  <hr>
  
  <h2>UPDATE: the issue was solved in both eclipse and netbeans.</h2>
  
  <p>in eclipse: right click the desired variable in the <em>Variables</em> window -> select <em>Display As Array</em> -> fill in the start index and the array length.</p>
  
  <p>in netbeans: in the <em>Watches</em> window add a new watch with the following format:</p>
  
  <pre><code>*((bar)+0)@10
  </code></pre>
  
  <p>where <code>bar</code> should be the pointer name,
  <code>0</code> should be your start index
  and <code>10</code> should be its length</p>
  
  <p>if i may add something personal: this is my first ever message on <em>stackoverflow</em>. i hope you found it useful.</p>