passing array to function with static error

void loop() {
  // put your main code here, to run repeatedly:
int myarray[10]={0};
bar(myarray);
}

void bar(int myArray[static 10]){
  
  
  }

why IDE is giving error ?
expected primary-expression before 'static'

you cannot use static in that context, just declare the array, e.g.

void bar(int myArray[10]){
}
//  ... or 
void bar2(int myArray[]){
}

what are you attempting to do?

Why i cant use?
In codeblocks and codelight same code is compiling without any warnings and errors in arduino its giving that error.

surepic:
Why i cant use?

because you get the compile error:

expected primary-expression before 'static'

:-)) i see that but question is why its working in other compilers but not in arduino ide?

surepic:
Why i cant use? .

Because you don't get to make up your own syntax. I'm not aware of any place that syntax is valid.

surepic:
:-)) i see that but question is why its working in other compilers but not in arduino ide?

C++ compilers? I doubt it....

In C99 its a valid syntax

surepic:
In C99 its a valid syntax

so you are trying to pass the array to a function? what's the issue?

have a look at
https://hamberg.no/erlend/posts/2013-02-18-static-array-indices.html

Just tried in avr studio 7 compiled without any errors

It's probably the IDE's auto-prototyping that's not coping well.
Try putting the function closer to the top of your incomplete sketch

I wrote prototype - no effect. Same error

surepic:
Just tried in avr studio 7 compiled without any errors

OK, thanks for the update.

since reply #1, static still cannot be used like that in C++

So arduino ide is using c++ compiler?

surepic:
So arduino ide is using c++ compiler?

yep

Am always using arduino ide and thought its c compiler. Thanks for info.

Think have to compile in both arduino ide and avr studio (with static) then compare the code see if avr is giving more efficient code.

void setup() {

}

void loop() {
  // put your main code here, to run repeatedly:
  int myarray[10] = {0};
  bar(myarray, sizeof(myarray)/sizeof(myarray[0]));
}

void bar(int myArray[10], size_t size) {


}

Even though in @horace given link author didnt define size as second argument but in c books examples are with areay size defined an given as second argument to function and comparison states that code with using static is efficient after compilation with c compiler that supports static keyword.

BulldogLowell:
yep

For additional info

#if defined(__STDC__)
Serial.println("everything ok");
#if(__STDC_VERSION__== 201103L)
    Serial.println("version >");
    #else 
    Serial.println("version <");
    #endif
#else 
Serial.println("no ok");
#endif

ISO/IEC 14882:2011
C++ 11 compiler