Can you explain how this C function works? It adds 2 numbers in BASE number system. long int add(long int a, long int b) { long int sum=0; long int k=1; int c=0; while(a || b || c) { sum+=k*(c-c%BASE)/BASE; c=a%10+b%10; sum+=c%BASE*k; if(sum>=BASE*k) { c=5; sum-=BASE*k; } k*=10; a/=10; b/=10; } return sum; }