forked from 0151n/Assign3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpoly.h
More file actions
39 lines (30 loc) · 881 Bytes
/
Copy pathpoly.h
File metadata and controls
39 lines (30 loc) · 881 Bytes
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
37
38
39
/*---------------------------------------------*
* Header file for poly.c *
* contains function and structure definitions *
*
* authors: Oisín O'Halloran --add other people*
* date 23/11/18 *
*---------------------------------------------*/
#ifndef POLY_H
#define POLY_H
//include standard library functions
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
//data structure for single polynomial
//int coeff[] --> variable length array of coefficients
//int size --> size of the coeff array
//
//structure must be initialised with make_poly() in order
//to allocate memory
typedef struct{
int size;
double coeff[];
}poly;
//------------functions------------
poly* make_poly(int size);
poly* polyAdd(poly* a, poly* b);
poly* polySub(poly* a, poly* b);
poly* create_poly(int size, double coefficients[]);
poly* delete_poly(poly* in);
#endif