Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- poly *poly_scalar_mult(poly *p, int x)
- {
- int i;
- node *N, *N2;
- poly *P;
- P=(poly *)malloc(sizeof(poly)); //Dynamically allocate space for poly
- N2=(node *)malloc(sizeof(node));
- P->num_terms=p->num_terms;;
- N=p->terms;
- P->terms=N2;
- for (i=0; i<p->num_terms; i++)
- {
- N2=(node *)malloc(sizeof(node));
- N2->powr=N->powr*x;
- N2->coef=N->coef;
- N2=N2->next;
- }
- return P;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement