Advertisement
Guest User

Untitled

a guest
Sep 18th, 2014
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. poly *poly_scalar_mult(poly *p, int x)
  2. {
  3. int i;
  4. node *N, *N2;
  5. poly *P;
  6. P=(poly *)malloc(sizeof(poly)); //Dynamically allocate space for poly
  7. N2=(node *)malloc(sizeof(node));
  8. P->num_terms=p->num_terms;;
  9. N=p->terms;
  10. P->terms=N2;
  11.  
  12. for (i=0; i<p->num_terms; i++)
  13. {
  14. N2=(node *)malloc(sizeof(node));
  15. N2->powr=N->powr*x;
  16. N2->coef=N->coef;
  17. N2=N2->next;
  18.  
  19. }
  20.  
  21. return P;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement