Skip to content

sebinsphilip/polynomial_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

polynomial_api

All basic polynomial operations in C. Polynomials are stored as linked lists.

Polynomial operations

  • Create polynomial - p = create_poly()
  • Read a polynomial string 'str' and convert it into polynomial type p - read_poly(p,str)
  • Add two polynomials p1 and p2 - p3 = add_poly(p1,p2)
  • Subtract two polynomials p1 and p2 - p3 = subtract_poly(p1,p2)
  • Multiply two polynomials p1 and p2 - p3 = multiply_poly(p1,p2)
  • Evaluate a polynomial p with a double value val - result = evaluate_poly(p,val)
  • Display a polynomial p - display_polynomial(p)
  • Delete a polynomial - delete_poly(p)

Files

  • polynomial.h - Header file containing all the function prototypes and data structures.
  • polynomial.c - The implementation of the polynomial functions.
  • test.c - Test file .

Run the code

For compiling and linking both test code and library functions in gcc compiler.
	>	gcc test.c polynomial.c -o polynomial -lm
For running the executable.
	>	./polynomial

##Reference

For read_poly(), the parsing was done using the concept of context free grammer. -[Erik Jansson] (https://erj.me/post/polynomial_in_c/)

About

All basic polynomial operations in C.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages