Advertisement
elnardu

Untitled

May 22nd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. Decimal * div10(const Decimal * a) {
  2.     Decimal * b = malloc(sizeof(Decimal));
  3.     b->n = a->n;
  4.     b->size = a->size;
  5.     b->a = malloc(b->n + 1);
  6.  
  7.     if (a->n > 0) {
  8.         b->n--;
  9.         for (int i = 0; i < a->n; i++) {
  10.             b->a[i] = a->a[i+1];
  11.         }
  12.     } else if (a->n == 0) {
  13.         b->a[0] = 0;
  14.     }
  15.    
  16.     return b;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement