'assign zero to item in char array [closed]

I have some materials showing this code. what does code means by making these assignments?

char inputfilename[128];
inputfilename[0] = 0;

char *argv[128];
*argv[1] = 0;


Solution 1:[1]

In C, character arrays are terminated by a null character (value 0). In both cases in your example, the code initializes the strings to "empty" (with a terminator in the first element). This would prove useful in any subsequent string operations (strcat, strcpy, etc.).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 mzimmers