snipplets.dev/~/C/clear_string.c

11 lines
183 B
C
Raw Normal View History

2023-07-30 01:03:55 +03:00
int main(int argc, char const *argv[])
{
char *buffer = malloc(256 + 1);
buffer[0] = '\0';
strcpy(buffer, "");
memset(buffer, '\0', sizeof(buffer));
return 0;
}