int mid_square(int z[],int length){
int i,cnt=3,sum=0;
if (length%2 == 0) { //even length
length = (length+1)/2;
}
else{ //odd length
length = length / 2;
}
for (i=length-2; i<=length+1; i++) {
sum+=z[i]*pow(10, cnt);
cnt--;
}
return sum;
}
In this code, I use length as function's local variable.
But I don't want to use the variable length.
What can I do??
Before I used the length = sizeof(z)/4, but length is always same value. (4?? 8?? I can't remember)