void test(int x[static 10]);
int main()
{
int a[]={1,2,3,4,5,6,7,8,9,10,11};
test(a);
return 0;
}
void test(int x[static 10])
{
printf("%d",x[9]);
}
I was looking for bizarre C statements. I found this one, But could not understand what is the use of static 10
in that statement. Is it same as int x[10]
?
Another thing, you can use volatile
also, in place of static
e.g int x[volatile 10]
Anybody knows what is the use of this kinda declaration?
PS: Compiled using GCC 4.6.3,
It's a hint for the compiler telling that the x
pointer parameter points to the first element of an array of at least 10
elements.
For example:
test(NULL); // undefined behavior
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