title: How to check a character array is null in objective C
body: <p>How to check a character array is null in objective C?</p>
  
  <pre><code>char hName[255]; 
  - (void)setHost {
       phent = gethostbyaddr((const char*)&amp;haddr, sizeof(int), AF_INET);
       if(phent){  
       strncpy(hName,phent-&gt;h_name,255);                                      
  
  }
  
  -(void) getHost {
      NSString *str = [[NSString alloc] initWithBytes:tTemp.hName 
      length:sizeof(tTemp.hName) encoding:NSASCIIStringEncoding];
   }
  </code></pre>
  
  <p>I have a character array named hName[255]. I will assign values to this array at some point of my project. Now i need to check if the hName[255] contains null value. i tried some methods. I get a string str from that array and check if it is equal to @""; It failed. Then i check the length of the string str. Even if the array contains no values it will return 255. How can i check the array contains null value. Any help? Thanks in advance!!</p>