title: unable to understand why adding zero in end after adding digits
body: <p><a href="http://www.spoj.com/problems/JULKA/help" rel="nofollow">http://www.spoj.com/problems/JULKA/help</a> me solve this question please .explain why we are adding zero in end after addition of bits.as commented in code below</p>
  
  <pre><code>    #include &lt;stdio.h&gt; 
      #include &lt;string.h&gt;
  
       #define MAX 111
  
       char klaudia[MAX], natalia[MAX], total[MAX], diff[MAX];
  
        void calc()
        {
            int len1 = strlen(total);
            int len2 = strlen(diff);
            int a, b, c, i, j, k, f;
            char temp[MAX];
  
            for(i=len1-1, j=len2-1, k=c=0; i&gt;=0 || j&gt;=0 || c; i--, j--, k++)
            {
                 a = i&gt;=0? total[i]-'0' : 0;
                 b = j&gt;=0? diff[j]-'0' : 0;
                 temp[k] = (a+b+c)%10 + '0';
                 c = (a+b+c)/10;
           }
          temp[k] = 0;//explain
  
          strcpy(klaudia,"0");
           //explain below for loop what is actually being done in this loop//
           for(i=k-1, j=a=f=0; i&gt;=0; i--)
           {
               b = (a*10 + temp[i]-'0') / 2;
               a = (a*10 + temp[i]-'0') % 2;
              if(b) f = 1;
              if(f) klaudia[j++] = b+'0';
          }
           if(!j) j++;
           klaudia[j] = 0;
  
           for(i=len1-1, j=len2-1, k=c=0; i&gt;=0; i--, j--, k++)
           {
               a = total[i]-'0';
               b = j&gt;=0? diff[j]-'0' : 0;
              if(a &lt; b+c)
             {
                   temp[k] = (10+a-b-c) + '0';
                   c = 1;
             }
              else
             {
                temp[k] = a-b-c + '0';
                c = 0;
             }
        }
        temp[k] = 0;
  
      strcpy(natalia,"0");
      for(i=k-1, j=a=f=0; i&gt;=0; i--)
      {
              b = (a*10 + temp[i]-'0') / 2;
              a = (a*10 + temp[i]-'0') % 2;
              if(b) f = 1;
              if(f) natalia[j++] = b+'0';
      }
      if(!j) j++;
      natalia[j] = 0;
   }
  
      int main()
      {
           while(scanf("%s %s", total, diff)==2)
            {
               calc();
               printf("%s\n%s\n", klaudia, natalia);
           }
            return 0;
      }
  </code></pre>
  
  <p>why are we adding zeo in array temp after we have added all the digits</p>