the following program is struck in for loop()

```
char a[] = {
'1','A','2','C','3','5','8','9'};
void setup(){
Serial.begin(9600);
int val = calculate();
Serial.println(val);
convert_to_hex(val);
}
void loop(){
//do nothing here
}
int calculate(){
int j = 0;
int val[strlen(a)/2];
for (int i = 0, j = 0 ; i < strlen(a); i+2, j++ ){
val[j] = conv(a[i],a[i+1]);
}//end of for loop
int sum = find_sum(val,sizeof(val));
return sum;
}//end of calculate() function
int find_sum(const int * val,int length){
int sum = 0;
for(int i=0;i<= length;i++){
sum = sum + val[i];
}//end of for loop
return sum;
}//end of find_sum() function
int conv(char val1,char val2){
int val_a = toDec(val1);
int val_b = toDec(val2);
return (val_a*16) + val_b;
}//end of conv() function
int toDec(char val){
if(val<='9'){
return val - '0';
}
else {
return val - '0'-7;
}
}//end of toDec() function
void convert_to_hex(int val){
char hex[5];
utoa((unsigned)val,hex,16);
int num = Serial.write(hex);
Serial.println(num);
}//end of convert_to_hex() fucntion
```

what iam doing wrong in this code ?