The following is the code in c.
fact(2);
void fact(static int i)
{..}
Output:Error cannot have static arguments
So why can't we have static arguments in a function?
The static keyword means that a variable may have only and exactly one instance in its scope, and that instance is invisible out of its scope. Neither of these requirements make sense for a function argument: it may be called multiple times, at a different memory address, and as it's meant for communication, it has to be visible to the outer world.
Trying to apply static to an argument doesn't make much sense, so the standard doesn't allow it (§6.7.5.3/2: "The only storage-class specifier that shall occur in a parameter declaration is register.")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With