When I do as below the code works fine :
#include <stdio.h>
void test( int a)
{
printf("a=%d\n",a);
}
int main()
{
test(10);
return 1;
}
But when I do
#include <stdio.h>
void test( auto int a) // Or static int a Or extern int a
{
printf("a=%d\n",a);
}
int main()
{
test(10);
return 1;
}
It generates an error,
error: storage class specified for parameter 'a'
Why is that error? What happens internally(memory management)?
But it works fine without any error when I do:
void test( register int a)
{
printf("a=%d\n",a);
}
Why is that?
static
? It would change with every call to the function anyway... And it definitely can't beextern
– Brewster