💡 Arrays-Spiral Print Anticlockwise

i am doing anticlockwise array print like this https://ide.codingblocks.com/s/164451

but getting error in passing array to the function anyone tell me whats the issue

Hey @Learning_bunny
In the function defintion, you need to write like :
void res(int arr[][10],int a, int b)
or
int x = 10; //declare this as a global variable.
void res(int arr[][x],int a, int b)

Because it is necessary to pass the column size and not necessary to pass the row size. And column size needs to be a constant value, so you can’t write int arr[a][b] in the definition, coz the sizes are variable in this.

Also while creating the array in your main function, you’ll have to write like:
int a[m][10];
coz for passing it into the function, the column size should be same,
Try and make these changes and your compilation error will be removed.

but the size of array is given by the user and let if i give it 10 in column and user gave a number >10 in column…then it will give error

@Learning_bunny
It’s given in the constraints of the question that the maximum no of columns can be 10.

please check the code again, i have made the req changes now it is printing m*10 values

??? maam please reply

Hey @Learning_bunny
The parameters passed during the function call in the main function are wrong. You need to write
counterClockspiralPrint(a, b, arr);
instead of
counterClockspiralPrint(R, C, arr);
Coz you’ve to give the actual array size.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.