Yes, it is safe, so long as you use valid variable names. They’re local variables, so their scope doesn’t go beyond the main
function.
From section 5.1.2.2.1 of the C standard:
The function called at program startup is named
main
. The
implementation declares no prototype for this function. It shall
be defined with a return type ofint
and with no parameters:int main(void) { /* ... */ }
or with two parameters (referred to here as
argc
andargv
, though any
names may be used, as they are local to the function in which they are
declared):int main(int argc, char *argv[]) { /* ... */ }
or equivalent; or in some other implementation-defined manner
That being said, using anything other than argc
and argv
might confuse others reading your code who are used to the conventional names for these parameters. So better to err on the side of clairity.