snipplets.dev/code/C/Strings/clear_string.c

10 lines
173 B
C

int main(int argc, char const *argv[]) {
char *buffer = malloc(256 + 1);
buffer[0] = '\0';
strcpy(buffer, "");
memset(buffer, '\0', sizeof(buffer));
return 0;
}