c++ int passed to a function is not declaired although it's declaired before

Hallo, in my code the int A is not declaired and I don't understand why.
I would like to pass A without problem into a for loop nested within an if.

code:

int A = SOME_DEFINED_NUM % OTHER_NUM; 
int k = VALUE;

void foo(int A) {                         
  if (A != 0) {                                           
      for (int i = 0; i < A; i++) {           
      color[i].val = 255 * abs(sin( (i * PI / OTHER_NUM)));    //this line works, color is a CHSV         
      ledHSV[(SOME_DEFINED_NUM  - A - 1) + i] = color[k]; //this line is the problem. A is not declaired here
  }
}
  1. Why is A not declaired? is there a way to make it declaired?
  2. Is it the for loop or the if loop?

Thank you very much

Hello, your code is incomplete.

Please stop wasting time.

Post all your code, post all your error messages.

Thank you very much.

Also, having two variables named A will not confuse the compiler but is likely to confuse you.

Read about scope.

The for() statement is missing a closing ‘}’.
Auto format the code to make such errors more obvious.