title: How to know if a char array has a null element in C?
body: <p>Say if I have : 
      <code>unsigned char* str = "k0kg"</code></p>
  
  <p>And 0 is the null element. When I loop through it using a for loop, how do I check if the array has a null?</p>
  
  <p>I tried:
      <code>if (str[1]==0):</code>
  I also tried:
      <code>if (str[1]=="0"):</code></p>
  
  <p>And they didn't work. :(</p>
  
  <p>The loop:</p>
  
  <pre><code>for (i=0;i&lt;num_bytes;i++){
      if (str[i]!=0){
          printf("null spotted\n");
  }
  </code></pre>