Guest User

Untitled

a guest
Jul 23rd, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.62 KB | None | 0 0
  1.  
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. //#include "polmul.h"
  5.  
  6. typedef union _pol {
  7.   int length;
  8.   int* asArr;
  9.   struct _part {
  10.     int start;
  11.     int end;
  12.     int **pol;
  13.   } asPart;
  14. } *pol;
  15.  
  16. int mymax(int a, int b) {
  17.   return (a>b)?a:b;
  18. }
  19.  
  20. pol alloc_pol(int length) {
  21.   pol ret = malloc(sizeof(union _pol));
  22.   ret->asArr = malloc(sizeof(int)*length);
  23.   ret->length=length;
  24.   return ret;
  25. }
  26.  
  27. void initialise_pol(pol p) {
  28.   int i;
  29.  
  30.   for (i=0; i<p->length; i++) {
  31.     p->asArr[i]=0;
  32.   }
  33. }
  34.  
  35. pol allocinit(int length) {
  36.   pol ret = alloc_pol(length);
  37.   initialise_pol(ret);
  38.   return ret;
  39. }
  40.  
  41. int main() {
  42.   allocinit(10);
  43.   return 0;
  44. }
Add Comment
Please, Sign In to add comment