title: How to clear all the elements of array in C?
body: <pre><code>volatile static uint8_t buffer[16];
  void ResetBuffer(){     
     for(int i=strlen((char*)buffer);i&gt;=0;i--) buffer[i]='\0'; 
  }
  </code></pre>
  
  <p>The buffer variable must be always used in micro controller, so I've used volatile static and it's global variable.
  <strong>But, to make all the buffer clear, is it right to code like this? If it's wrong or there's any other simple code, please show me some simple code.</strong></p>
  
  <p>I've heard that if I want to make it clear, then it would be easier to just make the first element empty. like this : buffer[0] = '\0';
  But, when I code it like that, another elements are still remained.</p>
  
  <p>I know it's a very simple question.
  But I'm confused. I've been normally programming in C++ or Java, so it's quite confused for me to program in C.</p>