在这里,我需要一些帮助来理解字符串。我有一个 buff,它被刷新然后传递给一个 UART 函数。该缓冲区现在已更新并保持一些值。我需要检查缓冲区的第 5 个字节。让我感到困惑的是,我在下面的代码中编写了代码。请看一下。
int main()  
{  
  char buff[8];
  memset(buff,0,8);  
  /*  
       This buff is used by some UART function, and hence is updated by UART  
       This buff now holds some data. And now, I need to check the 5th byte it is holding.  
  */   
  if(buff[4]==0x04)  //will this work? or I need to use if(strcmp(buff[4],0x04))  ???
  {  
    //Do some functionality, for an example    
    printf("True");  
  }  
  else  
    printf("False");  
  return 0;  
}