let’s say n=3
int n =3;
for(i = n-1; i >= 0; i--)
{
array[i]-=1;
}
Alternatively as @locus2k points out we can also iterate through the array starting at the 0th index as so
int n = 3;
for(i = 0; i < n; i++)
{
array[i]-=1;
}
2
solved I need to decrease first n elements of an array by 1