Search code examples
carduino

Empty char array in Arduino


I am working on small project using Arduino. I have this char array which used to store some values. the problem is How to set this char array to null after assign some values in Arduino?

char packetBuffer[200]

Solution

  • Use memset from string.h:

    memset(packetBuffer, 0, sizeof packetBuffer);