1. would you explain to me? hexadecimal to decimal

The below coding can correctly print out the result. But i do not understand the last part.
i--;
for(;i>=0;i--)
{
h=h+a[i]*m;
m=m*16;
}
how the i-- and m functions?

Code:
```#include<stdio.h>
#include<conio.h>
#include<string.h>

void hd();

void main()
{

{
int i,a[20];
unsigned long int h=0,m=1;
char s[20];

scanf("%s",s);
printf("Decimal Equivalent=");
for(i=0;s[i]!=NULL;i++)
{
switch(s[i])
{
case '0':
a[i]=0;
break;
case '1':
a[i]=1;
break;
case '2':
a[i]=2;
break;
case '3':
a[i]=3;
break;
case '4':
a[i]=4;
break;
case '5':
a[i]=5;
break;
case '6':
a[i]=6;
break;
case '7':
a[i]=7;
break;
case '8':
a[i]=8;
break;
case '9':
a[i]=9;
break;
case 'a':
case 'A':
a[i]=10;
break;
case 'b':
case 'B':
a[i]=11;
break;
case 'c':
case 'C':
a[i]=12;
break;
case 'd':
case 'D':
a[i]=13;
break;
case 'e':
case 'E':
a[i]=14;
break;
case 'f':
case 'F':
a[i]=15;
break;

}
}
i--;
for(;i>=0;i--)
{
h=h+a[i]*m;
m=m*16;
}
printf("%ld ",h);
}
}```

2. The last part of the code multiples the value of each digit by an increasing power of 16.

For example if you enter 0xA25. The final loops calculates.

10*(16*16) + 2*16 + 5 * 1 = 2560 + 32 + 5 = 2597

3. Oh...i see... suddenly realize by your solution.. thank you very much. Nice to see you here.