aboutsummaryrefslogtreecommitdiff
path: root/Computer_Science/data_structures/chapter_3/polynomial_in_list.c
blob: 0ecdf33db587d2c81afaa1734072fed41feb65f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <stdio.h>
#include <stdlib.h>

typedef struct node* ptr_to_node;

struct node
{
    int coefficient;
    int exponent;
    ptr_to_node next;
};


typedef ptr_to_node polynomial;

void add_polynomial(polynomial poly1, polynomial poly2,
        polynomial poly_sum)
{
}

void mult_polynomial(polynomial poly1, polynomial poly2,
        polynomial poly_prod)
{
}

void print_poly(polynomial poly)
{
    polynomial p;

    p = poly->next;

    for(; p != NULL; p = p->next)
        printf("%dx^%d + ", p->coefficient, p->exponent);
    
    printf("\n");
}