diff options
| author | Steve Lee <me@xiangyangli.com> | 2017-10-17 00:12:32 +0800 |
|---|---|---|
| committer | Steve Lee <me@xiangyangli.com> | 2017-10-17 00:12:32 +0800 |
| commit | b46c49228497cb440467167bad3123c327bd620f (patch) | |
| tree | 7547f4da0694b7c85e57e7e56cd1f0e6f3cdc4d8 /data_structures/chapter_3/polynomial_in_list.c | |
| parent | 37f4cc25e5bcf68539d2b3828ecff5d72ae8c74b (diff) | |
| download | 42-b46c49228497cb440467167bad3123c327bd620f.tar.xz 42-b46c49228497cb440467167bad3123c327bd620f.zip | |
add
Diffstat (limited to 'data_structures/chapter_3/polynomial_in_list.c')
| -rw-r--r-- | data_structures/chapter_3/polynomial_in_list.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/data_structures/chapter_3/polynomial_in_list.c b/data_structures/chapter_3/polynomial_in_list.c new file mode 100644 index 0000000..0ecdf33 --- /dev/null +++ b/data_structures/chapter_3/polynomial_in_list.c @@ -0,0 +1,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"); +} |
