title: Why use a Pointer and its dereference in if statement in c++
body: <p>I was looking for some c++ code, and was confused by <code>if(ptr &amp;&amp; *ptr)</code>, what does it do in this case?</p>
  
  <pre><code>// Process the data here.  We just break the data into separate pieces and 
  // display it for the sake of simplicity.
  char * a_pszBreak = NULL;
  char * a_pszDataItem = (char*)s_aucDataBuffer;
  do
  {
      // The poll data is terminated by either a Carriage Return alone, or a
      // Carriage Return/Line Feed pair.
      a_pszBreak = strpbrk(a_pszDataItem, "\n\r");
      if (a_pszBreak &amp;&amp; *a_pszBreak)
      {
          *a_pszBreak = 0;
          a_pszBreak++;
          LogPollData((const char *)a_pszDataItem);
      }
      a_pszDataItem = a_pszBreak;
  } while (a_pszBreak &amp;&amp; *a_pszBreak);
  </code></pre>