title: uninitialised value of size 8
body: <p>I am Running a code for valgrind</p>
  
  <pre><code>int fun(char* str) {
      char* prt1;
      char* ptr2;
      char sstr[20];
  
      strcpy(sstr, "\0");
  
      ptr1 = str;
      ptr2 = sstr;
  
      while (((isspace(*ptr1)) || (iscntrl(*ptr1))) &amp;&amp; (*ptr1 != '\0'))
          ptr1++;
  
      while (*ptr1 != '\0')
          *ptr2++ = *ptr1++;
  
      while (((isspace(*(ptr2 - 1))) || (iscntrl(*(ptr2 - 1)))) &amp;&amp; (ptr2 &gt; str))
          ptr2++;
  
      *ptr2 = '\0' strcpy(str, (S8*)sstr);
  
      return (strlen(ptr1));
  }
  </code></pre>
  
  <p>getting this error <strong><em>Use of uninitialised value of size 8</em></strong>
  for line </p>
  
  <pre><code>while (((isspace (*(ptr2-1))) || (iscntrl (*(ptr2-1)))) &amp;&amp;
       (ptr2 &gt; str))
  </code></pre>
  
  <p>If i put the <code>NULLP</code> check before assigning to the pointers this is error is gone</p>
  
  <pre><code>if (ptr1 != NULLP &amp;&amp; ptr2 != NULLP) {
      ptr1 = str;
      ptr2 = sstr;
  }
  </code></pre>
  
  <p>Is it with Valgrind code error or the check should be included ?</p>
  
  <p>Thanks for the help .</p>