a program to sum 2 arrays and display output in third array .Error: 'c' was not declared in this scope : Why it's giving error that 'c' was not declared in this scope ? Logically 'c' is declared before the for loop, so it can be accessed inside the for loop. Isn't it ?This is a program to sum 2 arrays and display output in third array.
I also wanted to know if this code could be optimized ?
    
    void sumOfTwoArrays(int arr[], int size1, int brr[], int size2, int crr[]){
    
    if(size1>size2){
    int crr[size1+1];
      int c = size1;
    }
    else{
    int crr[size2+1];
    int c = size2;
    }
    int r = 0;
    for(int i=size1-1,j=size2-1;i>=0&&j>=0;i--,j--){
    int n = arr[i] + brr[j] + r;
    if(n<=9){
      crr[c] = n;
    }
    else
    {
      int r = n/10;
      n = n%10;
      crr[c] = n;
    }
    c--;
    }
    
      while(arr[i]>=0){
        crr[c] = arr[i] + r;
        r = 0;
        c--;
      }
    while(brr[j]>=0){
    crr[c] = brr[j] + r;
    r = 0;
    c--;
    }
    if(r!=0){
    crr[c] = r;
    }
  
    }

