clear string

This commit is contained in:
Alexander Popov 2023-07-30 01:03:55 +03:00
parent 6bf29bf316
commit 5c26c657d5
Signed by: iiiypuk
GPG Key ID: E47FE0AB36CD5ED6
1 changed files with 10 additions and 0 deletions

10
~/C/clear_string.c Normal file
View File

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