2020-09-19 01:26:09 +08:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
< html xmlns = "http://www.w3.org/1999/xhtml" >
< head >
< meta http-equiv = "Content-Type" content = "text/xhtml;charset=UTF-8" / >
< meta http-equiv = "X-UA-Compatible" content = "IE=9" / >
2021-02-06 03:52:57 +08:00
< meta name = "generator" content = "Doxygen 1.9.1" / >
2020-09-19 01:26:09 +08:00
< meta name = "viewport" content = "width=device-width, initial-scale=1" / >
< title > Algorithms_in_C: misc/poly_add.c File Reference< / title >
< link href = "../../tabs.css" rel = "stylesheet" type = "text/css" / >
< script type = "text/javascript" src = "../../jquery.js" > < / script >
< script type = "text/javascript" src = "../../dynsections.js" > < / script >
< link href = "../../navtree.css" rel = "stylesheet" type = "text/css" / >
< script type = "text/javascript" src = "../../resize.js" > < / script >
< script type = "text/javascript" src = "../../navtreedata.js" > < / script >
< script type = "text/javascript" src = "../../navtree.js" > < / script >
< link href = "../../search/search.css" rel = "stylesheet" type = "text/css" / >
< script type = "text/javascript" src = "../../search/searchdata.js" > < / script >
< script type = "text/javascript" src = "../../search/search.js" > < / script >
< script type = "text/x-mathjax-config" >
MathJax.Hub.Config({
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
< / script >
< script type = "text/javascript" async = "async" src = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js" > < / script >
< link href = "../../doxygen.css" rel = "stylesheet" type = "text/css" / >
< / head >
< body >
< div id = "top" > <!-- do not remove this div, it is closed by doxygen! -->
< div id = "titlearea" >
< table cellspacing = "0" cellpadding = "0" >
< tbody >
< tr style = "height: 56px;" >
< td id = "projectalign" style = "padding-left: 0.5em;" >
< div id = "projectname" > Algorithms_in_C
  < span id = "projectnumber" > 1.0.0< / span >
< / div >
< div id = "projectbrief" > Set of algorithms implemented in C.< / div >
< / td >
< / tr >
< / tbody >
< / table >
< / div >
<!-- end header part -->
2021-02-06 03:52:57 +08:00
<!-- Generated by Doxygen 1.9.1 -->
2020-09-19 01:26:09 +08:00
< script type = "text/javascript" >
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3& dn=gpl-2.0.txt GPL-v2 */
2021-02-06 03:52:57 +08:00
var searchBox = new SearchBox("searchBox", "../../search",false,'Search','.html');
2020-09-19 01:26:09 +08:00
/* @license-end */
< / script >
< script type = "text/javascript" src = "../../menudata.js" > < / script >
< script type = "text/javascript" src = "../../menu.js" > < / script >
< script type = "text/javascript" >
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3& dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('../../',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */< / script >
< div id = "main-nav" > < / div >
< / div > <!-- top -->
< div id = "side-nav" class = "ui-resizable side-nav-resizable" >
< div id = "nav-tree" >
< div id = "nav-tree-contents" >
< div id = "nav-sync" class = "sync" > < / div >
< / div >
< / div >
< div id = "splitbar" style = "-moz-user-select:none;"
class="ui-resizable-handle">
< / div >
< / div >
< script type = "text/javascript" >
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3& dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('d0/dcb/poly__add_8c.html','../../'); initResizable(); });
/* @license-end */
< / script >
< div id = "doc-content" >
<!-- window showing the filter options -->
< div id = "MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
< / div >
<!-- iframe showing the search results (closed by default) -->
< div id = "MSearchResultsWindow" >
< iframe src = "javascript:void(0)" frameborder = "0"
name="MSearchResults" id="MSearchResults">
< / iframe >
< / div >
< div class = "header" >
< div class = "summary" >
< a href = "#nested-classes" > Data Structures< / a > |
< a href = "#func-members" > Functions< / a > < / div >
< div class = "headertitle" >
< div class = "title" > poly_add.c File Reference< / div > < / div >
< / div > <!-- header -->
< div class = "contents" >
< p > Implementation of < a href = "https://en.wikipedia.org/wiki/Polynomial#Addition" > Addition of two polynomials< / a >
< a href = "#details" > More...< / a > < / p >
< div class = "textblock" > < code > #include < stdio.h> < / code > < br / >
< code > #include < stdlib.h> < / code > < br / >
< / div > < div class = "textblock" > < div class = "dynheader" >
Include dependency graph for poly_add.c:< / div >
< div class = "dyncontent" >
< div class = "center" > < iframe scrolling = "no" frameborder = "0" src = "../../dc/dbe/poly__add_8c__incl.svg" width = "160" height = "112" > < p > < b > This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.< / b > < / p > < / iframe >
< / div >
< / div >
< / div > < table class = "memberdecls" >
< tr class = "heading" > < td colspan = "2" > < h2 class = "groupheader" > < a name = "nested-classes" > < / a >
Data Structures< / h2 > < / td > < / tr >
< tr class = "memitem:" > < td class = "memItemLeft" align = "right" valign = "top" > struct   < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../df/d86/structterm.html" > term< / a > < / td > < / tr >
< tr class = "memdesc:" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > identifier for single-variable polynomial coefficients as a linked list < a href = "../../df/d86/structterm.html#details" > More...< / a > < br / > < / td > < / tr >
< tr class = "separator:" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< / table > < table class = "memberdecls" >
< tr class = "heading" > < td colspan = "2" > < h2 class = "groupheader" > < a name = "func-members" > < / a >
Functions< / h2 > < / td > < / tr >
< tr class = "memitem:a5a103fff33166d6e4d975b8b63c6e895" > < td class = "memItemLeft" align = "right" valign = "top" > void  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../d0/dcb/poly__add_8c.html#a5a103fff33166d6e4d975b8b63c6e895" > free_poly< / a > (struct < a class = "el" href = "../../df/d86/structterm.html" > term< / a > *poly)< / td > < / tr >
< tr class = "memdesc:a5a103fff33166d6e4d975b8b63c6e895" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > Frees memory space. < a href = "../../d0/dcb/poly__add_8c.html#a5a103fff33166d6e4d975b8b63c6e895" > More...< / a > < br / > < / td > < / tr >
< tr class = "separator:a5a103fff33166d6e4d975b8b63c6e895" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:a29eace09ec1373a92003075f1c2f6d9d" > < td class = "memItemLeft" align = "right" valign = "top" > void  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (struct < a class = "el" href = "../../df/d86/structterm.html" > term< / a > **poly, int coef, int pow)< / td > < / tr >
< tr class = "memdesc:a29eace09ec1373a92003075f1c2f6d9d" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > The function will create a polynomial. < a href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > More...< / a > < br / > < / td > < / tr >
< tr class = "separator:a29eace09ec1373a92003075f1c2f6d9d" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:a6ff38afe4720527c9513139cbab460af" > < td class = "memItemLeft" align = "right" valign = "top" > void  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../d0/dcb/poly__add_8c.html#a6ff38afe4720527c9513139cbab460af" > poly_add< / a > (struct < a class = "el" href = "../../df/d86/structterm.html" > term< / a > **pol, struct < a class = "el" href = "../../df/d86/structterm.html" > term< / a > *poly1, struct < a class = "el" href = "../../df/d86/structterm.html" > term< / a > *poly2)< / td > < / tr >
< tr class = "memdesc:a6ff38afe4720527c9513139cbab460af" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > The function will add 2 polynomials. < a href = "../../d0/dcb/poly__add_8c.html#a6ff38afe4720527c9513139cbab460af" > More...< / a > < br / > < / td > < / tr >
< tr class = "separator:a6ff38afe4720527c9513139cbab460af" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:ab9b9bedcb99f279d491d1b856791a36d" > < td class = "memItemLeft" align = "right" valign = "top" > void  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../d0/dcb/poly__add_8c.html#ab9b9bedcb99f279d491d1b856791a36d" > display_polynomial< / a > (struct < a class = "el" href = "../../df/d86/structterm.html" > term< / a > *poly)< / td > < / tr >
< tr class = "memdesc:ab9b9bedcb99f279d491d1b856791a36d" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > The function will display the polynomial. < a href = "../../d0/dcb/poly__add_8c.html#ab9b9bedcb99f279d491d1b856791a36d" > More...< / a > < br / > < / td > < / tr >
< tr class = "separator:ab9b9bedcb99f279d491d1b856791a36d" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:ab215107dbb50c7efa811a687ce9b95af" > < td class = "memItemLeft" align = "right" valign = "top" > static void  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../d0/dcb/poly__add_8c.html#ab215107dbb50c7efa811a687ce9b95af" > test1< / a > (struct < a class = "el" href = "../../df/d86/structterm.html" > term< / a > *poly1, struct < a class = "el" href = "../../df/d86/structterm.html" > term< / a > *poly2, struct < a class = "el" href = "../../df/d86/structterm.html" > term< / a > *poly3)< / td > < / tr >
< tr class = "memdesc:ab215107dbb50c7efa811a687ce9b95af" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > Test function 1. < a href = "../../d0/dcb/poly__add_8c.html#ab215107dbb50c7efa811a687ce9b95af" > More...< / a > < br / > < / td > < / tr >
< tr class = "separator:ab215107dbb50c7efa811a687ce9b95af" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:a0c5173884bd798a6ca6f437b9b932409" > < td class = "memItemLeft" align = "right" valign = "top" > static void  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../d0/dcb/poly__add_8c.html#a0c5173884bd798a6ca6f437b9b932409" > test2< / a > (struct < a class = "el" href = "../../df/d86/structterm.html" > term< / a > *poly1, struct < a class = "el" href = "../../df/d86/structterm.html" > term< / a > *poly2, struct < a class = "el" href = "../../df/d86/structterm.html" > term< / a > *poly3)< / td > < / tr >
< tr class = "memdesc:a0c5173884bd798a6ca6f437b9b932409" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > Test function 2. < a href = "../../d0/dcb/poly__add_8c.html#a0c5173884bd798a6ca6f437b9b932409" > More...< / a > < br / > < / td > < / tr >
< tr class = "separator:a0c5173884bd798a6ca6f437b9b932409" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:ab138609c765e2fd8b89e9c107cd40d57" > < td class = "memItemLeft" align = "right" valign = "top" > static void  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../d0/dcb/poly__add_8c.html#ab138609c765e2fd8b89e9c107cd40d57" > test3< / a > (struct < a class = "el" href = "../../df/d86/structterm.html" > term< / a > *poly1, struct < a class = "el" href = "../../df/d86/structterm.html" > term< / a > *poly2, struct < a class = "el" href = "../../df/d86/structterm.html" > term< / a > *poly3)< / td > < / tr >
< tr class = "memdesc:ab138609c765e2fd8b89e9c107cd40d57" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > Test function 3. < a href = "../../d0/dcb/poly__add_8c.html#ab138609c765e2fd8b89e9c107cd40d57" > More...< / a > < br / > < / td > < / tr >
< tr class = "separator:ab138609c765e2fd8b89e9c107cd40d57" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:a840291bc02cba5474a4cb46a9b9566fe" > < td class = "memItemLeft" align = "right" valign = "top" > int  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../d0/dcb/poly__add_8c.html#a840291bc02cba5474a4cb46a9b9566fe" > main< / a > (void)< / td > < / tr >
< tr class = "memdesc:a840291bc02cba5474a4cb46a9b9566fe" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > Main function. < a href = "../../d0/dcb/poly__add_8c.html#a840291bc02cba5474a4cb46a9b9566fe" > More...< / a > < br / > < / td > < / tr >
< tr class = "separator:a840291bc02cba5474a4cb46a9b9566fe" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< / table >
< a name = "details" id = "details" > < / a > < h2 class = "groupheader" > Detailed Description< / h2 >
< div class = "textblock" > < p > Implementation of < a href = "https://en.wikipedia.org/wiki/Polynomial#Addition" > Addition of two polynomials< / a > < / p >
2021-02-06 03:52:57 +08:00
< dl class = "section author" > < dt > Author< / dt > < dd > < a href = "https://github.com/Ankita19ms0010" > Ankita Roy Chowdhury< / a > < / dd > < / dl >
< p > This code takes two polynomials as input and prints their sum using linked list. The polynomials must be in increasing or decreasing order of degree. Degree must be positive. < / p >
2020-09-19 01:26:09 +08:00
< / div > < h2 class = "groupheader" > Function Documentation< / h2 >
< a id = "a29eace09ec1373a92003075f1c2f6d9d" > < / a >
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#a29eace09ec1373a92003075f1c2f6d9d" > ◆ < / a > < / span > create_polynomial()< / h2 >
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > void create_polynomial < / td >
< td > (< / td >
< td class = "paramtype" > struct < a class = "el" href = "../../df/d86/structterm.html" > term< / a > **  < / td >
< td class = "paramname" > < em > poly< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > int  < / td >
< td class = "paramname" > < em > coef< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > int  < / td >
< td class = "paramname" > < em > pow< / em >   < / td >
< / tr >
< tr >
< td > < / td >
< td > )< / td >
< td > < / td > < td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > The function will create a polynomial. < / p >
< dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > poly< / td > < td > stores the address of the polynomial being created < / td > < / tr >
< tr > < td class = "paramname" > coef< / td > < td > contains the coefficient of the node < / td > < / tr >
< tr > < td class = "paramname" > pow< / td > < td > contains the degree < / td > < / tr >
< / table >
< / dd >
< / dl >
< dl class = "section return" > < dt > Returns< / dt > < dd > none < / dd > < / dl >
< div class = "fragment" > < div class = "line" > < a name = "l00055" > < / a > < span class = "lineno" > 55< / span >   {< / div >
< div class = "line" > < a name = "l00056" > < / a > < span class = "lineno" > 56< / span >   < span class = "comment" > // Creating the polynomial using temporary linked lists< / span > < / div >
< div class = "line" > < a name = "l00057" > < / a > < span class = "lineno" > 57< / span >   < span class = "keyword" > struct < / span > < a class = "code" href = "../../df/d86/structterm.html" > term< / a > *temp1, *temp2;< / div >
< div class = "line" > < a name = "l00058" > < / a > < span class = "lineno" > 58< / span >   temp1 = *poly; < span class = "comment" > // Contains the null pointer< / span > < / div >
< div class = "line" > < a name = "l00059" > < / a > < span class = "lineno" > 59< / span >   < / div >
< div class = "line" > < a name = "l00060" > < / a > < span class = "lineno" > 60< / span >   < span class = "comment" > // Initiating first term< / span > < / div >
< div class = "line" > < a name = "l00061" > < / a > < span class = "lineno" > 61< / span >   < span class = "keywordflow" > if< / span > (temp1 == NULL)< / div >
< div class = "line" > < a name = "l00062" > < / a > < span class = "lineno" > 62< / span >   {< / div >
< div class = "line" > < a name = "l00063" > < / a > < span class = "lineno" > 63< / span >   temp2 = (< span class = "keyword" > struct < / span > < a class = "code" href = "../../df/d86/structterm.html" > term< / a > *)malloc(< / div >
< div class = "line" > < a name = "l00064" > < / a > < span class = "lineno" > 64< / span >   < span class = "keyword" > sizeof< / span > (< span class = "keyword" > struct< / span > < a class = "code" href = "../../df/d86/structterm.html" > term< / a > )); < span class = "comment" > // Dynamic node creation< / span > < / div >
< div class = "line" > < a name = "l00065" > < / a > < span class = "lineno" > 65< / span >   temp2-> < a class = "code" href = "../../df/d86/structterm.html#a5a730814391f70179da78c657e6e6f7b" > coef< / a > = < a class = "code" href = "../../df/d86/structterm.html#a5a730814391f70179da78c657e6e6f7b" > coef< / a > ;< / div >
< div class = "line" > < a name = "l00066" > < / a > < span class = "lineno" > 66< / span >   temp2-> < a class = "code" href = "../../df/d86/structterm.html#a057f161d279d856d11786aa96fc87f74" > pow< / a > = < a class = "code" href = "../../df/d86/structterm.html#a057f161d279d856d11786aa96fc87f74" > pow< / a > ;< / div >
< div class = "line" > < a name = "l00067" > < / a > < span class = "lineno" > 67< / span >   < span class = "comment" > // Updating the null pointer with the address of the first node of the< / span > < / div >
< div class = "line" > < a name = "l00068" > < / a > < span class = "lineno" > 68< / span >   < span class = "comment" > // polynomial just created< / span > < / div >
< div class = "line" > < a name = "l00069" > < / a > < span class = "lineno" > 69< / span >   *poly = temp2;< / div >
< div class = "line" > < a name = "l00070" > < / a > < span class = "lineno" > 70< / span >   temp2-> < a class = "code" href = "../../df/d86/structterm.html#ab7ac49a58cc431c9838c855bf59a243a" > next< / a > = NULL; < span class = "comment" > // Increasing the pointer temp2< / span > < / div >
< div class = "line" > < a name = "l00071" > < / a > < span class = "lineno" > 71< / span >   }< / div >
< div class = "line" > < a name = "l00072" > < / a > < span class = "lineno" > 72< / span >   < span class = "comment" > // Creating the rest of the nodes< / span > < / div >
< div class = "line" > < a name = "l00073" > < / a > < span class = "lineno" > 73< / span >   < span class = "keywordflow" > else< / span > < / div >
< div class = "line" > < a name = "l00074" > < / a > < span class = "lineno" > 74< / span >   {< / div >
< div class = "line" > < a name = "l00075" > < / a > < span class = "lineno" > 75< / span >   temp2-> < a class = "code" href = "../../df/d86/structterm.html#ab7ac49a58cc431c9838c855bf59a243a" > next< / a > = (< span class = "keyword" > struct < / span > < a class = "code" href = "../../df/d86/structterm.html" > term< / a > *)malloc(< / div >
< div class = "line" > < a name = "l00076" > < / a > < span class = "lineno" > 76< / span >   < span class = "keyword" > sizeof< / span > (< span class = "keyword" > struct< / span > < a class = "code" href = "../../df/d86/structterm.html" > term< / a > )); < span class = "comment" > // Dynamic node creation< / span > < / div >
< div class = "line" > < a name = "l00077" > < / a > < span class = "lineno" > 77< / span >   temp2 = temp2-> < a class = "code" href = "../../df/d86/structterm.html#ab7ac49a58cc431c9838c855bf59a243a" > next< / a > ; < span class = "comment" > // Increasing the pointer temp2< / span > < / div >
< div class = "line" > < a name = "l00078" > < / a > < span class = "lineno" > 78< / span >   temp2-> < a class = "code" href = "../../df/d86/structterm.html#a5a730814391f70179da78c657e6e6f7b" > coef< / a > = < a class = "code" href = "../../df/d86/structterm.html#a5a730814391f70179da78c657e6e6f7b" > coef< / a > ;< / div >
< div class = "line" > < a name = "l00079" > < / a > < span class = "lineno" > 79< / span >   temp2-> < a class = "code" href = "../../df/d86/structterm.html#a057f161d279d856d11786aa96fc87f74" > pow< / a > = < a class = "code" href = "../../df/d86/structterm.html#a057f161d279d856d11786aa96fc87f74" > pow< / a > ;< / div >
< div class = "line" > < a name = "l00080" > < / a > < span class = "lineno" > 80< / span >   temp2-> < a class = "code" href = "../../df/d86/structterm.html#ab7ac49a58cc431c9838c855bf59a243a" > next< / a > = NULL;< / div >
< div class = "line" > < a name = "l00081" > < / a > < span class = "lineno" > 81< / span >   }< / div >
< div class = "line" > < a name = "l00082" > < / a > < span class = "lineno" > 82< / span >   }< / div >
2021-02-06 03:52:57 +08:00
< div class = "ttc" id = "astructterm_html" > < div class = "ttname" > < a href = "../../df/d86/structterm.html" > term< / a > < / div > < div class = "ttdoc" > identifier for single-variable polynomial coefficients as a linked list< / div > < div class = "ttdef" > < b > Definition:< / b > poly_add.c:20< / div > < / div >
< div class = "ttc" id = "astructterm_html_a057f161d279d856d11786aa96fc87f74" > < div class = "ttname" > < a href = "../../df/d86/structterm.html#a057f161d279d856d11786aa96fc87f74" > term::pow< / a > < / div > < div class = "ttdeci" > int pow< / div > < div class = "ttdoc" > power of the polynomial term< / div > < div class = "ttdef" > < b > Definition:< / b > poly_add.c:22< / div > < / div >
< div class = "ttc" id = "astructterm_html_a5a730814391f70179da78c657e6e6f7b" > < div class = "ttname" > < a href = "../../df/d86/structterm.html#a5a730814391f70179da78c657e6e6f7b" > term::coef< / a > < / div > < div class = "ttdeci" > int coef< / div > < div class = "ttdoc" > coefficient value< / div > < div class = "ttdef" > < b > Definition:< / b > poly_add.c:21< / div > < / div >
< div class = "ttc" id = "astructterm_html_ab7ac49a58cc431c9838c855bf59a243a" > < div class = "ttname" > < a href = "../../df/d86/structterm.html#ab7ac49a58cc431c9838c855bf59a243a" > term::next< / a > < / div > < div class = "ttdeci" > struct term * next< / div > < div class = "ttdoc" > pointer to the successive term< / div > < div class = "ttdef" > < b > Definition:< / b > poly_add.c:23< / div > < / div >
2020-09-19 01:26:09 +08:00
< / div > <!-- fragment -->
< / div >
< / div >
< a id = "ab9b9bedcb99f279d491d1b856791a36d" > < / a >
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#ab9b9bedcb99f279d491d1b856791a36d" > ◆ < / a > < / span > display_polynomial()< / h2 >
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > void display_polynomial < / td >
< td > (< / td >
< td class = "paramtype" > struct < a class = "el" href = "../../df/d86/structterm.html" > term< / a > *  < / td >
< td class = "paramname" > < em > poly< / em > < / td > < td > )< / td >
< td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > The function will display the polynomial. < / p >
< dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > poly< / td > < td > first term of the polynomial to be displayed < / td > < / tr >
< / table >
< / dd >
< / dl >
< dl class = "section return" > < dt > Returns< / dt > < dd > none < / dd > < / dl >
< div class = "fragment" > < div class = "line" > < a name = "l00183" > < / a > < span class = "lineno" > 183< / span >   {< / div >
< div class = "line" > < a name = "l00184" > < / a > < span class = "lineno" > 184< / span >   < span class = "keywordflow" > while< / span > (poly != NULL)< / div >
< div class = "line" > < a name = "l00185" > < / a > < span class = "lineno" > 185< / span >   {< / div >
< div class = "line" > < a name = "l00186" > < / a > < span class = "lineno" > 186< / span >   printf(< span class = "stringliteral" > " %d x^%d" < / span > , poly-> < a class = "code" href = "../../df/d86/structterm.html#a5a730814391f70179da78c657e6e6f7b" > coef< / a > , poly-> < a class = "code" href = "../../df/d86/structterm.html#a057f161d279d856d11786aa96fc87f74" > pow< / a > );< / div >
< div class = "line" > < a name = "l00187" > < / a > < span class = "lineno" > 187< / span >   poly = poly-> < a class = "code" href = "../../df/d86/structterm.html#ab7ac49a58cc431c9838c855bf59a243a" > next< / a > ;< / div >
< div class = "line" > < a name = "l00188" > < / a > < span class = "lineno" > 188< / span >   < span class = "keywordflow" > if< / span > (poly != NULL)< / div >
< div class = "line" > < a name = "l00189" > < / a > < span class = "lineno" > 189< / span >   {< / div >
< div class = "line" > < a name = "l00190" > < / a > < span class = "lineno" > 190< / span >   printf(< span class = "stringliteral" > " + " < / span > );< / div >
< div class = "line" > < a name = "l00191" > < / a > < span class = "lineno" > 191< / span >   }< / div >
< div class = "line" > < a name = "l00192" > < / a > < span class = "lineno" > 192< / span >   }< / div >
< div class = "line" > < a name = "l00193" > < / a > < span class = "lineno" > 193< / span >   }< / div >
< / div > <!-- fragment -->
< / div >
< / div >
< a id = "a5a103fff33166d6e4d975b8b63c6e895" > < / a >
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#a5a103fff33166d6e4d975b8b63c6e895" > ◆ < / a > < / span > free_poly()< / h2 >
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > void free_poly < / td >
< td > (< / td >
< td class = "paramtype" > struct < a class = "el" href = "../../df/d86/structterm.html" > term< / a > *  < / td >
< td class = "paramname" > < em > poly< / em > < / td > < td > )< / td >
< td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > Frees memory space. < / p >
< dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > poly< / td > < td > first term of polynomial < / td > < / tr >
< / table >
< / dd >
< / dl >
< dl class = "section return" > < dt > Returns< / dt > < dd > void < / dd > < / dl >
< div class = "fragment" > < div class = "line" > < a name = "l00032" > < / a > < span class = "lineno" > 32< / span >   {< / div >
< div class = "line" > < a name = "l00033" > < / a > < span class = "lineno" > 33< / span >   < span class = "keywordflow" > if< / span > (!poly)< / div >
< div class = "line" > < a name = "l00034" > < / a > < span class = "lineno" > 34< / span >   {< / div >
< div class = "line" > < a name = "l00035" > < / a > < span class = "lineno" > 35< / span >   < span class = "keywordflow" > return< / span > ; < span class = "comment" > // NULL pointer does not need delete< / span > < / div >
< div class = "line" > < a name = "l00036" > < / a > < span class = "lineno" > 36< / span >   }< / div >
< div class = "line" > < a name = "l00037" > < / a > < span class = "lineno" > 37< / span >   < span class = "keywordflow" > else< / span > < / div >
< div class = "line" > < a name = "l00038" > < / a > < span class = "lineno" > 38< / span >   {< / div >
< div class = "line" > < a name = "l00039" > < / a > < span class = "lineno" > 39< / span >   < span class = "keywordflow" > while< / span > (!poly-> < a class = "code" href = "../../df/d86/structterm.html#ab7ac49a58cc431c9838c855bf59a243a" > next< / a > )< / div >
< div class = "line" > < a name = "l00040" > < / a > < span class = "lineno" > 40< / span >   {< / div >
< div class = "line" > < a name = "l00041" > < / a > < span class = "lineno" > 41< / span >   free(poly-> < a class = "code" href = "../../df/d86/structterm.html#ab7ac49a58cc431c9838c855bf59a243a" > next< / a > ); < span class = "comment" > // Deletes next term< / span > < / div >
< div class = "line" > < a name = "l00042" > < / a > < span class = "lineno" > 42< / span >   }< / div >
< div class = "line" > < a name = "l00043" > < / a > < span class = "lineno" > 43< / span >   free(poly); < span class = "comment" > // delete the current term< / span > < / div >
< div class = "line" > < a name = "l00044" > < / a > < span class = "lineno" > 44< / span >   }< / div >
< div class = "line" > < a name = "l00045" > < / a > < span class = "lineno" > 45< / span >   }< / div >
< / div > <!-- fragment -->
< / div >
< / div >
< a id = "a840291bc02cba5474a4cb46a9b9566fe" > < / a >
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#a840291bc02cba5474a4cb46a9b9566fe" > ◆ < / a > < / span > main()< / h2 >
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > int main < / td >
< td > (< / td >
< td class = "paramtype" > void  < / td >
< td class = "paramname" > < / td > < td > )< / td >
< td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > Main function. < / p >
< dl class = "section return" > < dt > Returns< / dt > < dd > 0 on exit < / dd > < / dl >
< div class = "fragment" > < div class = "line" > < a name = "l00312" > < / a > < span class = "lineno" > 312< / span >   {< / div >
< div class = "line" > < a name = "l00313" > < / a > < span class = "lineno" > 313< / span >   < span class = "keyword" > struct < / span > < a class = "code" href = "../../df/d86/structterm.html" > term< / a > *poly1 = NULL, *poly2 = NULL, *poly3 = NULL;< / div >
< div class = "line" > < a name = "l00314" > < / a > < span class = "lineno" > 314< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#ab215107dbb50c7efa811a687ce9b95af" > test1< / a > (poly1, poly2, poly3);< / div >
< div class = "line" > < a name = "l00315" > < / a > < span class = "lineno" > 315< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#a0c5173884bd798a6ca6f437b9b932409" > test2< / a > (poly1, poly2, poly3);< / div >
< div class = "line" > < a name = "l00316" > < / a > < span class = "lineno" > 316< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#ab138609c765e2fd8b89e9c107cd40d57" > test3< / a > (poly1, poly2, poly3);< / div >
< div class = "line" > < a name = "l00317" > < / a > < span class = "lineno" > 317< / span >   < / div >
< div class = "line" > < a name = "l00318" > < / a > < span class = "lineno" > 318< / span >   < span class = "keywordflow" > return< / span > 0;< / div >
< div class = "line" > < a name = "l00319" > < / a > < span class = "lineno" > 319< / span >   }< / div >
2021-02-06 03:52:57 +08:00
< div class = "ttc" id = "apoly__add_8c_html_a0c5173884bd798a6ca6f437b9b932409" > < div class = "ttname" > < a href = "../../d0/dcb/poly__add_8c.html#a0c5173884bd798a6ca6f437b9b932409" > test2< / a > < / div > < div class = "ttdeci" > static void test2(struct term *poly1, struct term *poly2, struct term *poly3)< / div > < div class = "ttdoc" > Test function 2.< / div > < div class = "ttdef" > < b > Definition:< / b > poly_add.c:239< / div > < / div >
< div class = "ttc" id = "apoly__add_8c_html_ab138609c765e2fd8b89e9c107cd40d57" > < div class = "ttname" > < a href = "../../d0/dcb/poly__add_8c.html#ab138609c765e2fd8b89e9c107cd40d57" > test3< / a > < / div > < div class = "ttdeci" > static void test3(struct term *poly1, struct term *poly2, struct term *poly3)< / div > < div class = "ttdoc" > Test function 3.< / div > < div class = "ttdef" > < b > Definition:< / b > poly_add.c:279< / div > < / div >
< div class = "ttc" id = "apoly__add_8c_html_ab215107dbb50c7efa811a687ce9b95af" > < div class = "ttname" > < a href = "../../d0/dcb/poly__add_8c.html#ab215107dbb50c7efa811a687ce9b95af" > test1< / a > < / div > < div class = "ttdeci" > static void test1(struct term *poly1, struct term *poly2, struct term *poly3)< / div > < div class = "ttdoc" > Test function 1.< / div > < div class = "ttdef" > < b > Definition:< / b > poly_add.c:204< / div > < / div >
2020-09-19 01:26:09 +08:00
< / div > <!-- fragment --> < div class = "dynheader" >
Here is the call graph for this function:< / div >
< div class = "dyncontent" >
< div class = "center" > < iframe scrolling = "no" frameborder = "0" src = "../../d0/dcb/poly__add_8c_a840291bc02cba5474a4cb46a9b9566fe_cgraph.svg" width = "340" height = "190" > < p > < b > This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.< / b > < / p > < / iframe >
< / div >
< / div >
< / div >
< / div >
< a id = "a6ff38afe4720527c9513139cbab460af" > < / a >
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#a6ff38afe4720527c9513139cbab460af" > ◆ < / a > < / span > poly_add()< / h2 >
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > void poly_add < / td >
< td > (< / td >
< td class = "paramtype" > struct < a class = "el" href = "../../df/d86/structterm.html" > term< / a > **  < / td >
< td class = "paramname" > < em > pol< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > struct < a class = "el" href = "../../df/d86/structterm.html" > term< / a > *  < / td >
< td class = "paramname" > < em > poly1< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > struct < a class = "el" href = "../../df/d86/structterm.html" > term< / a > *  < / td >
< td class = "paramname" > < em > poly2< / em >   < / td >
< / tr >
< tr >
< td > < / td >
< td > )< / td >
< td > < / td > < td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > The function will add 2 polynomials. < / p >
< dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > poly1< / td > < td > first polynomial of the addition < / td > < / tr >
< tr > < td class = "paramname" > poly2< / td > < td > second polynomial of the addition < / td > < / tr >
< tr > < td class = "paramname" > pol< / td > < td > the resultant polynomial < / td > < / tr >
< / table >
< / dd >
< / dl >
< div class = "fragment" > < div class = "line" > < a name = "l00092" > < / a > < span class = "lineno" > 92< / span >   {< / div >
< div class = "line" > < a name = "l00093" > < / a > < span class = "lineno" > 93< / span >   < span class = "comment" > // Creating a temporary linked list to store the resultant polynomial< / span > < / div >
< div class = "line" > < a name = "l00094" > < / a > < span class = "lineno" > 94< / span >   < span class = "keyword" > struct < / span > < a class = "code" href = "../../df/d86/structterm.html" > term< / a > *temp = (< span class = "keyword" > struct < / span > < a class = "code" href = "../../df/d86/structterm.html" > term< / a > *)malloc(< span class = "keyword" > sizeof< / span > (< span class = "keyword" > struct< / span > < a class = "code" href = "../../df/d86/structterm.html" > term< / a > ));< / div >
< div class = "line" > < a name = "l00095" > < / a > < span class = "lineno" > 95< / span >   temp-> next = NULL;< / div >
< div class = "line" > < a name = "l00096" > < / a > < span class = "lineno" > 96< / span >   *pol =< / div >
< div class = "line" > < a name = "l00097" > < / a > < span class = "lineno" > 97< / span >   temp; < span class = "comment" > //*pol always points to the 1st node of the resultant polynomial< / span > < / div >
< div class = "line" > < a name = "l00098" > < / a > < span class = "lineno" > 98< / span >   < / div >
< div class = "line" > < a name = "l00099" > < / a > < span class = "lineno" > 99< / span >   < span class = "comment" > // Comparing the powers of the nodes of both the polynomials< / span > < / div >
< div class = "line" > < a name = "l00100" > < / a > < span class = "lineno" > 100< / span >   < span class = "comment" > // until one gets exhausted< / span > < / div >
< div class = "line" > < a name = "l00101" > < / a > < span class = "lineno" > 101< / span >   < span class = "keywordflow" > while< / span > (poly1 & & poly2)< / div >
< div class = "line" > < a name = "l00102" > < / a > < span class = "lineno" > 102< / span >   {< / div >
< div class = "line" > < a name = "l00103" > < / a > < span class = "lineno" > 103< / span >   < span class = "comment" > /* If the power of the first polynomial is greater than the power of the< / span > < / div >
< div class = "line" > < a name = "l00104" > < / a > < span class = "lineno" > 104< / span >   < span class = "comment" > second one place the power and coefficient of that node of the first< / span > < / div >
< div class = "line" > < a name = "l00105" > < / a > < span class = "lineno" > 105< / span >   < span class = "comment" > polynomial in temp and increase the pointer poly1< / span > < / div >
< div class = "line" > < a name = "l00106" > < / a > < span class = "lineno" > 106< / span >   < span class = "comment" > */< / span > < / div >
< div class = "line" > < a name = "l00107" > < / a > < span class = "lineno" > 107< / span >   < span class = "keywordflow" > if< / span > (poly1-> < a class = "code" href = "../../df/d86/structterm.html#a057f161d279d856d11786aa96fc87f74" > pow< / a > > poly2-> < a class = "code" href = "../../df/d86/structterm.html#a057f161d279d856d11786aa96fc87f74" > pow< / a > )< / div >
< div class = "line" > < a name = "l00108" > < / a > < span class = "lineno" > 108< / span >   {< / div >
< div class = "line" > < a name = "l00109" > < / a > < span class = "lineno" > 109< / span >   temp-> coef = poly1-> < a class = "code" href = "../../df/d86/structterm.html#a5a730814391f70179da78c657e6e6f7b" > coef< / a > ;< / div >
< div class = "line" > < a name = "l00110" > < / a > < span class = "lineno" > 110< / span >   temp-> pow = poly1-> < a class = "code" href = "../../df/d86/structterm.html#a057f161d279d856d11786aa96fc87f74" > pow< / a > ;< / div >
< div class = "line" > < a name = "l00111" > < / a > < span class = "lineno" > 111< / span >   poly1 = poly1-> < a class = "code" href = "../../df/d86/structterm.html#ab7ac49a58cc431c9838c855bf59a243a" > next< / a > ;< / div >
< div class = "line" > < a name = "l00112" > < / a > < span class = "lineno" > 112< / span >   }< / div >
< div class = "line" > < a name = "l00113" > < / a > < span class = "lineno" > 113< / span >   < span class = "comment" > /* If the power of the second polynomial is greater than the power of< / span > < / div >
< div class = "line" > < a name = "l00114" > < / a > < span class = "lineno" > 114< / span >   < span class = "comment" > the first one place the power and coefficient of that node of the< / span > < / div >
< div class = "line" > < a name = "l00115" > < / a > < span class = "lineno" > 115< / span >   < span class = "comment" > second polynomial in temp and increase the pointer poly2< / span > < / div >
< div class = "line" > < a name = "l00116" > < / a > < span class = "lineno" > 116< / span >   < span class = "comment" > */< / span > < / div >
< div class = "line" > < a name = "l00117" > < / a > < span class = "lineno" > 117< / span >   < span class = "keywordflow" > else< / span > < span class = "keywordflow" > if< / span > (poly1-> < a class = "code" href = "../../df/d86/structterm.html#a057f161d279d856d11786aa96fc87f74" > pow< / a > < poly2-> < a class = "code" href = "../../df/d86/structterm.html#a057f161d279d856d11786aa96fc87f74" > pow< / a > )< / div >
< div class = "line" > < a name = "l00118" > < / a > < span class = "lineno" > 118< / span >   {< / div >
< div class = "line" > < a name = "l00119" > < / a > < span class = "lineno" > 119< / span >   temp-> coef = poly2-> < a class = "code" href = "../../df/d86/structterm.html#a5a730814391f70179da78c657e6e6f7b" > coef< / a > ;< / div >
< div class = "line" > < a name = "l00120" > < / a > < span class = "lineno" > 120< / span >   temp-> pow = poly2-> < a class = "code" href = "../../df/d86/structterm.html#a057f161d279d856d11786aa96fc87f74" > pow< / a > ;< / div >
< div class = "line" > < a name = "l00121" > < / a > < span class = "lineno" > 121< / span >   poly2 = poly2-> < a class = "code" href = "../../df/d86/structterm.html#ab7ac49a58cc431c9838c855bf59a243a" > next< / a > ;< / div >
< div class = "line" > < a name = "l00122" > < / a > < span class = "lineno" > 122< / span >   }< / div >
< div class = "line" > < a name = "l00123" > < / a > < span class = "lineno" > 123< / span >   < span class = "comment" > /* If both of them have same power then sum the coefficients< / span > < / div >
< div class = "line" > < a name = "l00124" > < / a > < span class = "lineno" > 124< / span >   < span class = "comment" > place both the summed coefficient and the power in temp< / span > < / div >
< div class = "line" > < a name = "l00125" > < / a > < span class = "lineno" > 125< / span >   < span class = "comment" > increase both the pointers poly1 and poly2< / span > < / div >
< div class = "line" > < a name = "l00126" > < / a > < span class = "lineno" > 126< / span >   < span class = "comment" > */< / span > < / div >
< div class = "line" > < a name = "l00127" > < / a > < span class = "lineno" > 127< / span >   < span class = "keywordflow" > else< / span > < / div >
< div class = "line" > < a name = "l00128" > < / a > < span class = "lineno" > 128< / span >   {< / div >
< div class = "line" > < a name = "l00129" > < / a > < span class = "lineno" > 129< / span >   temp-> coef = poly1-> < a class = "code" href = "../../df/d86/structterm.html#a5a730814391f70179da78c657e6e6f7b" > coef< / a > + poly2-> < a class = "code" href = "../../df/d86/structterm.html#a5a730814391f70179da78c657e6e6f7b" > coef< / a > ;< / div >
< div class = "line" > < a name = "l00130" > < / a > < span class = "lineno" > 130< / span >   temp-> pow = poly1-> < a class = "code" href = "../../df/d86/structterm.html#a057f161d279d856d11786aa96fc87f74" > pow< / a > ;< / div >
< div class = "line" > < a name = "l00131" > < / a > < span class = "lineno" > 131< / span >   poly1 = poly1-> < a class = "code" href = "../../df/d86/structterm.html#ab7ac49a58cc431c9838c855bf59a243a" > next< / a > ;< / div >
< div class = "line" > < a name = "l00132" > < / a > < span class = "lineno" > 132< / span >   poly2 = poly2-> < a class = "code" href = "../../df/d86/structterm.html#ab7ac49a58cc431c9838c855bf59a243a" > next< / a > ;< / div >
< div class = "line" > < a name = "l00133" > < / a > < span class = "lineno" > 133< / span >   }< / div >
< div class = "line" > < a name = "l00134" > < / a > < span class = "lineno" > 134< / span >   < span class = "comment" > /* If none of the polynomials are exhausted< / span > < / div >
< div class = "line" > < a name = "l00135" > < / a > < span class = "lineno" > 135< / span >   < span class = "comment" > dynamically create a node in temp< / span > < / div >
< div class = "line" > < a name = "l00136" > < / a > < span class = "lineno" > 136< / span >   < span class = "comment" > */< / span > < / div >
< div class = "line" > < a name = "l00137" > < / a > < span class = "lineno" > 137< / span >   < span class = "keywordflow" > if< / span > (poly1 & & poly2)< / div >
< div class = "line" > < a name = "l00138" > < / a > < span class = "lineno" > 138< / span >   {< / div >
< div class = "line" > < a name = "l00139" > < / a > < span class = "lineno" > 139< / span >   temp-> next = (< span class = "keyword" > struct < / span > < a class = "code" href = "../../df/d86/structterm.html" > term< / a > *)malloc(< / div >
< div class = "line" > < a name = "l00140" > < / a > < span class = "lineno" > 140< / span >   < span class = "keyword" > sizeof< / span > (< span class = "keyword" > struct< / span > < a class = "code" href = "../../df/d86/structterm.html" > term< / a > )); < span class = "comment" > // Dynamic node creation< / span > < / div >
< div class = "line" > < a name = "l00141" > < / a > < span class = "lineno" > 141< / span >   temp = temp-> next; < span class = "comment" > // Increase the pointer temp< / span > < / div >
< div class = "line" > < a name = "l00142" > < / a > < span class = "lineno" > 142< / span >   temp-> next = NULL;< / div >
< div class = "line" > < a name = "l00143" > < / a > < span class = "lineno" > 143< / span >   }< / div >
< div class = "line" > < a name = "l00144" > < / a > < span class = "lineno" > 144< / span >   }< / div >
< div class = "line" > < a name = "l00145" > < / a > < span class = "lineno" > 145< / span >   < span class = "comment" > /* If one of the polynomials is exhausted< / span > < / div >
< div class = "line" > < a name = "l00146" > < / a > < span class = "lineno" > 146< / span >   < span class = "comment" > place the rest of the other polynomial as it is in temp< / span > < / div >
< div class = "line" > < a name = "l00147" > < / a > < span class = "lineno" > 147< / span >   < span class = "comment" > by creating nodes dynamically< / span > < / div >
< div class = "line" > < a name = "l00148" > < / a > < span class = "lineno" > 148< / span >   < span class = "comment" > */< / span > < / div >
< div class = "line" > < a name = "l00149" > < / a > < span class = "lineno" > 149< / span >   < span class = "keywordflow" > while< / span > (poly1 || poly2)< / div >
< div class = "line" > < a name = "l00150" > < / a > < span class = "lineno" > 150< / span >   {< / div >
< div class = "line" > < a name = "l00151" > < / a > < span class = "lineno" > 151< / span >   temp-> next = (< span class = "keyword" > struct < / span > < a class = "code" href = "../../df/d86/structterm.html" > term< / a > *)malloc(< / div >
< div class = "line" > < a name = "l00152" > < / a > < span class = "lineno" > 152< / span >   < span class = "keyword" > sizeof< / span > (< span class = "keyword" > struct< / span > < a class = "code" href = "../../df/d86/structterm.html" > term< / a > )); < span class = "comment" > // Dynamic node creation< / span > < / div >
< div class = "line" > < a name = "l00153" > < / a > < span class = "lineno" > 153< / span >   temp = temp-> next; < span class = "comment" > // Increasing the pointer< / span > < / div >
< div class = "line" > < a name = "l00154" > < / a > < span class = "lineno" > 154< / span >   temp-> next = NULL;< / div >
< div class = "line" > < a name = "l00155" > < / a > < span class = "lineno" > 155< / span >   < / div >
< div class = "line" > < a name = "l00156" > < / a > < span class = "lineno" > 156< / span >   < span class = "comment" > /* If poly1 is not exhausted< / span > < / div >
< div class = "line" > < a name = "l00157" > < / a > < span class = "lineno" > 157< / span >   < span class = "comment" > place rest of that polynomial in temp< / span > < / div >
< div class = "line" > < a name = "l00158" > < / a > < span class = "lineno" > 158< / span >   < span class = "comment" > */< / span > < / div >
< div class = "line" > < a name = "l00159" > < / a > < span class = "lineno" > 159< / span >   < span class = "keywordflow" > if< / span > (poly1)< / div >
< div class = "line" > < a name = "l00160" > < / a > < span class = "lineno" > 160< / span >   {< / div >
< div class = "line" > < a name = "l00161" > < / a > < span class = "lineno" > 161< / span >   temp-> coef = poly1-> < a class = "code" href = "../../df/d86/structterm.html#a5a730814391f70179da78c657e6e6f7b" > coef< / a > ;< / div >
< div class = "line" > < a name = "l00162" > < / a > < span class = "lineno" > 162< / span >   temp-> pow = poly1-> < a class = "code" href = "../../df/d86/structterm.html#a057f161d279d856d11786aa96fc87f74" > pow< / a > ;< / div >
< div class = "line" > < a name = "l00163" > < / a > < span class = "lineno" > 163< / span >   poly1 = poly1-> < a class = "code" href = "../../df/d86/structterm.html#ab7ac49a58cc431c9838c855bf59a243a" > next< / a > ;< / div >
< div class = "line" > < a name = "l00164" > < / a > < span class = "lineno" > 164< / span >   }< / div >
< div class = "line" > < a name = "l00165" > < / a > < span class = "lineno" > 165< / span >   < span class = "comment" > /* If poly2 is not exhausted< / span > < / div >
< div class = "line" > < a name = "l00166" > < / a > < span class = "lineno" > 166< / span >   < span class = "comment" > place rest of that polynomial in temp< / span > < / div >
< div class = "line" > < a name = "l00167" > < / a > < span class = "lineno" > 167< / span >   < span class = "comment" > */< / span > < / div >
< div class = "line" > < a name = "l00168" > < / a > < span class = "lineno" > 168< / span >   < span class = "keywordflow" > else< / span > < span class = "keywordflow" > if< / span > (poly2)< / div >
< div class = "line" > < a name = "l00169" > < / a > < span class = "lineno" > 169< / span >   {< / div >
< div class = "line" > < a name = "l00170" > < / a > < span class = "lineno" > 170< / span >   temp-> coef = poly2-> < a class = "code" href = "../../df/d86/structterm.html#a5a730814391f70179da78c657e6e6f7b" > coef< / a > ;< / div >
< div class = "line" > < a name = "l00171" > < / a > < span class = "lineno" > 171< / span >   temp-> pow = poly2-> < a class = "code" href = "../../df/d86/structterm.html#a057f161d279d856d11786aa96fc87f74" > pow< / a > ;< / div >
< div class = "line" > < a name = "l00172" > < / a > < span class = "lineno" > 172< / span >   poly2 = poly2-> < a class = "code" href = "../../df/d86/structterm.html#ab7ac49a58cc431c9838c855bf59a243a" > next< / a > ;< / div >
< div class = "line" > < a name = "l00173" > < / a > < span class = "lineno" > 173< / span >   }< / div >
< div class = "line" > < a name = "l00174" > < / a > < span class = "lineno" > 174< / span >   }< / div >
< div class = "line" > < a name = "l00175" > < / a > < span class = "lineno" > 175< / span >   }< / div >
< / div > <!-- fragment -->
< / div >
< / div >
< a id = "ab215107dbb50c7efa811a687ce9b95af" > < / a >
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#ab215107dbb50c7efa811a687ce9b95af" > ◆ < / a > < / span > test1()< / h2 >
< div class = "memitem" >
< div class = "memproto" >
< table class = "mlabels" >
< tr >
< td class = "mlabels-left" >
< table class = "memname" >
< tr >
< td class = "memname" > static void test1 < / td >
< td > (< / td >
< td class = "paramtype" > struct < a class = "el" href = "../../df/d86/structterm.html" > term< / a > *  < / td >
< td class = "paramname" > < em > poly1< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > struct < a class = "el" href = "../../df/d86/structterm.html" > term< / a > *  < / td >
< td class = "paramname" > < em > poly2< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > struct < a class = "el" href = "../../df/d86/structterm.html" > term< / a > *  < / td >
< td class = "paramname" > < em > poly3< / em >   < / td >
< / tr >
< tr >
< td > < / td >
< td > )< / td >
< td > < / td > < td > < / td >
< / tr >
< / table >
< / td >
< td class = "mlabels-right" >
< span class = "mlabels" > < span class = "mlabel" > static< / span > < / span > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > Test function 1. < / p >
< p > Polynomial 1 is 5 x^2 + 3 x^1 + 2 x^0 Polynomial 2 is 7 x^3 + 9 x^1 + 10 x^0 Resultant polynomial is 7 x^3 + 5 x^2 + 12 x^1 + 12 x^0 < / p > < dl class = "section return" > < dt > Returns< / dt > < dd > void < / dd > < / dl >
< div class = "fragment" > < div class = "line" > < a name = "l00205" > < / a > < span class = "lineno" > 205< / span >   {< / div >
< div class = "line" > < a name = "l00206" > < / a > < span class = "lineno" > 206< / span >   printf(< span class = "stringliteral" > " \n----Test 1----\n" < / span > );< / div >
< div class = "line" > < a name = "l00207" > < / a > < span class = "lineno" > 207< / span >   printf(< span class = "stringliteral" > " \nFirst Polynomial:\n" < / span > ); < span class = "comment" > // Defining the 1st polynomial< / span > < / div >
< div class = "line" > < a name = "l00208" > < / a > < span class = "lineno" > 208< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly1, 5, 2);< / div >
< div class = "line" > < a name = "l00209" > < / a > < span class = "lineno" > 209< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly1, 3, 1);< / div >
< div class = "line" > < a name = "l00210" > < / a > < span class = "lineno" > 210< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly1, 2, 0);< / div >
< div class = "line" > < a name = "l00211" > < / a > < span class = "lineno" > 211< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#ab9b9bedcb99f279d491d1b856791a36d" > display_polynomial< / a > (poly1);< / div >
< div class = "line" > < a name = "l00212" > < / a > < span class = "lineno" > 212< / span >   < / div >
< div class = "line" > < a name = "l00213" > < / a > < span class = "lineno" > 213< / span >   printf(< span class = "stringliteral" > " \nSecond Polynomial:\n" < / span > ); < span class = "comment" > // Defining the 2nd polynomial< / span > < / div >
< div class = "line" > < a name = "l00214" > < / a > < span class = "lineno" > 214< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly2, 7, 3);< / div >
< div class = "line" > < a name = "l00215" > < / a > < span class = "lineno" > 215< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly2, 9, 1);< / div >
< div class = "line" > < a name = "l00216" > < / a > < span class = "lineno" > 216< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly2, 10, 0);< / div >
< div class = "line" > < a name = "l00217" > < / a > < span class = "lineno" > 217< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#ab9b9bedcb99f279d491d1b856791a36d" > display_polynomial< / a > (poly2);< / div >
< div class = "line" > < a name = "l00218" > < / a > < span class = "lineno" > 218< / span >   < / div >
< div class = "line" > < a name = "l00219" > < / a > < span class = "lineno" > 219< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#a6ff38afe4720527c9513139cbab460af" > poly_add< / a > (& poly3, poly1, poly2); < span class = "comment" > // Adding the two polynomials< / span > < / div >
< div class = "line" > < a name = "l00220" > < / a > < span class = "lineno" > 220< / span >   printf(< span class = "stringliteral" > " \nResultant polynomial:\n" < / span > );< / div >
< div class = "line" > < a name = "l00221" > < / a > < span class = "lineno" > 221< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#ab9b9bedcb99f279d491d1b856791a36d" > display_polynomial< / a > (poly3);< / div >
< div class = "line" > < a name = "l00222" > < / a > < span class = "lineno" > 222< / span >   printf(< span class = "stringliteral" > " \n" < / span > );< / div >
< div class = "line" > < a name = "l00223" > < / a > < span class = "lineno" > 223< / span >   < / div >
< div class = "line" > < a name = "l00224" > < / a > < span class = "lineno" > 224< / span >   < span class = "comment" > // Frees memory space< / span > < / div >
< div class = "line" > < a name = "l00225" > < / a > < span class = "lineno" > 225< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#a5a103fff33166d6e4d975b8b63c6e895" > free_poly< / a > (poly1);< / div >
< div class = "line" > < a name = "l00226" > < / a > < span class = "lineno" > 226< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#a5a103fff33166d6e4d975b8b63c6e895" > free_poly< / a > (poly2);< / div >
< div class = "line" > < a name = "l00227" > < / a > < span class = "lineno" > 227< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#a5a103fff33166d6e4d975b8b63c6e895" > free_poly< / a > (poly3);< / div >
< div class = "line" > < a name = "l00228" > < / a > < span class = "lineno" > 228< / span >   }< / div >
2021-02-06 03:52:57 +08:00
< div class = "ttc" id = "apoly__add_8c_html_a29eace09ec1373a92003075f1c2f6d9d" > < div class = "ttname" > < a href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > < / div > < div class = "ttdeci" > void create_polynomial(struct term **poly, int coef, int pow)< / div > < div class = "ttdoc" > The function will create a polynomial.< / div > < div class = "ttdef" > < b > Definition:< / b > poly_add.c:54< / div > < / div >
< div class = "ttc" id = "apoly__add_8c_html_a5a103fff33166d6e4d975b8b63c6e895" > < div class = "ttname" > < a href = "../../d0/dcb/poly__add_8c.html#a5a103fff33166d6e4d975b8b63c6e895" > free_poly< / a > < / div > < div class = "ttdeci" > void free_poly(struct term *poly)< / div > < div class = "ttdoc" > Frees memory space.< / div > < div class = "ttdef" > < b > Definition:< / b > poly_add.c:31< / div > < / div >
< div class = "ttc" id = "apoly__add_8c_html_a6ff38afe4720527c9513139cbab460af" > < div class = "ttname" > < a href = "../../d0/dcb/poly__add_8c.html#a6ff38afe4720527c9513139cbab460af" > poly_add< / a > < / div > < div class = "ttdeci" > void poly_add(struct term **pol, struct term *poly1, struct term *poly2)< / div > < div class = "ttdoc" > The function will add 2 polynomials.< / div > < div class = "ttdef" > < b > Definition:< / b > poly_add.c:91< / div > < / div >
< div class = "ttc" id = "apoly__add_8c_html_ab9b9bedcb99f279d491d1b856791a36d" > < div class = "ttname" > < a href = "../../d0/dcb/poly__add_8c.html#ab9b9bedcb99f279d491d1b856791a36d" > display_polynomial< / a > < / div > < div class = "ttdeci" > void display_polynomial(struct term *poly)< / div > < div class = "ttdoc" > The function will display the polynomial.< / div > < div class = "ttdef" > < b > Definition:< / b > poly_add.c:182< / div > < / div >
2020-09-19 01:26:09 +08:00
< / div > <!-- fragment --> < div class = "dynheader" >
Here is the call graph for this function:< / div >
< div class = "dyncontent" >
< div class = "center" > < iframe scrolling = "no" frameborder = "0" src = "../../d0/dcb/poly__add_8c_ab215107dbb50c7efa811a687ce9b95af_cgraph.svg" width = "242" height = "190" > < p > < b > This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.< / b > < / p > < / iframe >
< / div >
< / div >
< / div >
< / div >
< a id = "a0c5173884bd798a6ca6f437b9b932409" > < / a >
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#a0c5173884bd798a6ca6f437b9b932409" > ◆ < / a > < / span > test2()< / h2 >
< div class = "memitem" >
< div class = "memproto" >
< table class = "mlabels" >
< tr >
< td class = "mlabels-left" >
< table class = "memname" >
< tr >
< td class = "memname" > static void test2 < / td >
< td > (< / td >
< td class = "paramtype" > struct < a class = "el" href = "../../df/d86/structterm.html" > term< / a > *  < / td >
< td class = "paramname" > < em > poly1< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > struct < a class = "el" href = "../../df/d86/structterm.html" > term< / a > *  < / td >
< td class = "paramname" > < em > poly2< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > struct < a class = "el" href = "../../df/d86/structterm.html" > term< / a > *  < / td >
< td class = "paramname" > < em > poly3< / em >   < / td >
< / tr >
< tr >
< td > < / td >
< td > )< / td >
< td > < / td > < td > < / td >
< / tr >
< / table >
< / td >
< td class = "mlabels-right" >
< span class = "mlabels" > < span class = "mlabel" > static< / span > < / span > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > Test function 2. < / p >
< p > Polynomial 1 is 3 x^5 + 1 x^4 + 2 x^3 + -2 x^1 + 5 x^0 Polynomial 2 is 2 x^5 + 3 x^3 + 7 x^1 + 2 x^0 Resultant polynomial is 5 x^5 + 1 x^4 + 5 x^3 + 5 x^1 + 7 x^0 < / p > < dl class = "section return" > < dt > Returns< / dt > < dd > void < / dd > < / dl >
< div class = "fragment" > < div class = "line" > < a name = "l00240" > < / a > < span class = "lineno" > 240< / span >   {< / div >
< div class = "line" > < a name = "l00241" > < / a > < span class = "lineno" > 241< / span >   printf(< span class = "stringliteral" > " \n----Test 2----\n" < / span > );< / div >
< div class = "line" > < a name = "l00242" > < / a > < span class = "lineno" > 242< / span >   printf(< span class = "stringliteral" > " \nFirst Polynomial:\n" < / span > ); < span class = "comment" > // Defining the 1st polynomial< / span > < / div >
< div class = "line" > < a name = "l00243" > < / a > < span class = "lineno" > 243< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly1, 3, 5);< / div >
< div class = "line" > < a name = "l00244" > < / a > < span class = "lineno" > 244< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly1, 1, 4);< / div >
< div class = "line" > < a name = "l00245" > < / a > < span class = "lineno" > 245< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly1, 2, 3);< / div >
< div class = "line" > < a name = "l00246" > < / a > < span class = "lineno" > 246< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly1, -2, 1);< / div >
< div class = "line" > < a name = "l00247" > < / a > < span class = "lineno" > 247< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly1, 5, 0);< / div >
< div class = "line" > < a name = "l00248" > < / a > < span class = "lineno" > 248< / span >   < / div >
< div class = "line" > < a name = "l00249" > < / a > < span class = "lineno" > 249< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#ab9b9bedcb99f279d491d1b856791a36d" > display_polynomial< / a > (poly1);< / div >
< div class = "line" > < a name = "l00250" > < / a > < span class = "lineno" > 250< / span >   < / div >
< div class = "line" > < a name = "l00251" > < / a > < span class = "lineno" > 251< / span >   printf(< span class = "stringliteral" > " \nSecond Polynomial:\n" < / span > ); < span class = "comment" > // Defining the 2nd polynomial< / span > < / div >
< div class = "line" > < a name = "l00252" > < / a > < span class = "lineno" > 252< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly2, 2, 5);< / div >
< div class = "line" > < a name = "l00253" > < / a > < span class = "lineno" > 253< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly2, 3, 3);< / div >
< div class = "line" > < a name = "l00254" > < / a > < span class = "lineno" > 254< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly2, 7, 1);< / div >
< div class = "line" > < a name = "l00255" > < / a > < span class = "lineno" > 255< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly2, 2, 0);< / div >
< div class = "line" > < a name = "l00256" > < / a > < span class = "lineno" > 256< / span >   < / div >
< div class = "line" > < a name = "l00257" > < / a > < span class = "lineno" > 257< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#ab9b9bedcb99f279d491d1b856791a36d" > display_polynomial< / a > (poly2);< / div >
< div class = "line" > < a name = "l00258" > < / a > < span class = "lineno" > 258< / span >   < / div >
< div class = "line" > < a name = "l00259" > < / a > < span class = "lineno" > 259< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#a6ff38afe4720527c9513139cbab460af" > poly_add< / a > (& poly3, poly1, poly2); < span class = "comment" > // Adding the two polynomials< / span > < / div >
< div class = "line" > < a name = "l00260" > < / a > < span class = "lineno" > 260< / span >   printf(< span class = "stringliteral" > " \nResultant polynomial:\n" < / span > );< / div >
< div class = "line" > < a name = "l00261" > < / a > < span class = "lineno" > 261< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#ab9b9bedcb99f279d491d1b856791a36d" > display_polynomial< / a > (poly3);< / div >
< div class = "line" > < a name = "l00262" > < / a > < span class = "lineno" > 262< / span >   printf(< span class = "stringliteral" > " \n" < / span > );< / div >
< div class = "line" > < a name = "l00263" > < / a > < span class = "lineno" > 263< / span >   < / div >
< div class = "line" > < a name = "l00264" > < / a > < span class = "lineno" > 264< / span >   < span class = "comment" > // Frees memory space< / span > < / div >
< div class = "line" > < a name = "l00265" > < / a > < span class = "lineno" > 265< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#a5a103fff33166d6e4d975b8b63c6e895" > free_poly< / a > (poly1);< / div >
< div class = "line" > < a name = "l00266" > < / a > < span class = "lineno" > 266< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#a5a103fff33166d6e4d975b8b63c6e895" > free_poly< / a > (poly2);< / div >
< div class = "line" > < a name = "l00267" > < / a > < span class = "lineno" > 267< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#a5a103fff33166d6e4d975b8b63c6e895" > free_poly< / a > (poly3);< / div >
< div class = "line" > < a name = "l00268" > < / a > < span class = "lineno" > 268< / span >   }< / div >
< / div > <!-- fragment --> < div class = "dynheader" >
Here is the call graph for this function:< / div >
< div class = "dyncontent" >
< div class = "center" > < iframe scrolling = "no" frameborder = "0" src = "../../d0/dcb/poly__add_8c_a0c5173884bd798a6ca6f437b9b932409_cgraph.svg" width = "242" height = "190" > < p > < b > This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.< / b > < / p > < / iframe >
< / div >
< / div >
< / div >
< / div >
< a id = "ab138609c765e2fd8b89e9c107cd40d57" > < / a >
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#ab138609c765e2fd8b89e9c107cd40d57" > ◆ < / a > < / span > test3()< / h2 >
< div class = "memitem" >
< div class = "memproto" >
< table class = "mlabels" >
< tr >
< td class = "mlabels-left" >
< table class = "memname" >
< tr >
< td class = "memname" > static void test3 < / td >
< td > (< / td >
< td class = "paramtype" > struct < a class = "el" href = "../../df/d86/structterm.html" > term< / a > *  < / td >
< td class = "paramname" > < em > poly1< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > struct < a class = "el" href = "../../df/d86/structterm.html" > term< / a > *  < / td >
< td class = "paramname" > < em > poly2< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > struct < a class = "el" href = "../../df/d86/structterm.html" > term< / a > *  < / td >
< td class = "paramname" > < em > poly3< / em >   < / td >
< / tr >
< tr >
< td > < / td >
< td > )< / td >
< td > < / td > < td > < / td >
< / tr >
< / table >
< / td >
< td class = "mlabels-right" >
< span class = "mlabels" > < span class = "mlabel" > static< / span > < / span > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > Test function 3. < / p >
< p > Polynomial 1 is -12 x^0 + 8 x^1 + 4 x^3 Polynomial 2 is 5 x^0 + -13 x^1 + 3 x^3 Resultant polynomial is -7 x^0 + -5 x^1 + 7 x^3 < / p > < dl class = "section return" > < dt > Returns< / dt > < dd > void < / dd > < / dl >
< div class = "fragment" > < div class = "line" > < a name = "l00280" > < / a > < span class = "lineno" > 280< / span >   {< / div >
< div class = "line" > < a name = "l00281" > < / a > < span class = "lineno" > 281< / span >   printf(< span class = "stringliteral" > " \n----Test 3----\n" < / span > );< / div >
< div class = "line" > < a name = "l00282" > < / a > < span class = "lineno" > 282< / span >   printf(< span class = "stringliteral" > " \nFirst Polynomial:\n" < / span > ); < span class = "comment" > // Defining the 1st polynomial< / span > < / div >
< div class = "line" > < a name = "l00283" > < / a > < span class = "lineno" > 283< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly1, -12, 0);< / div >
< div class = "line" > < a name = "l00284" > < / a > < span class = "lineno" > 284< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly1, 8, 1);< / div >
< div class = "line" > < a name = "l00285" > < / a > < span class = "lineno" > 285< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly1, 4, 3);< / div >
< div class = "line" > < a name = "l00286" > < / a > < span class = "lineno" > 286< / span >   < / div >
< div class = "line" > < a name = "l00287" > < / a > < span class = "lineno" > 287< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#ab9b9bedcb99f279d491d1b856791a36d" > display_polynomial< / a > (poly1);< / div >
< div class = "line" > < a name = "l00288" > < / a > < span class = "lineno" > 288< / span >   < / div >
< div class = "line" > < a name = "l00289" > < / a > < span class = "lineno" > 289< / span >   printf(< span class = "stringliteral" > " \nSecond Polynomial:\n" < / span > ); < span class = "comment" > // Defining the 2nd polynomial< / span > < / div >
< div class = "line" > < a name = "l00290" > < / a > < span class = "lineno" > 290< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly2, 5, 0);< / div >
< div class = "line" > < a name = "l00291" > < / a > < span class = "lineno" > 291< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly2, -13, 1);< / div >
< div class = "line" > < a name = "l00292" > < / a > < span class = "lineno" > 292< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly2, 3, 3);< / div >
< div class = "line" > < a name = "l00293" > < / a > < span class = "lineno" > 293< / span >   < / div >
< div class = "line" > < a name = "l00294" > < / a > < span class = "lineno" > 294< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#ab9b9bedcb99f279d491d1b856791a36d" > display_polynomial< / a > (poly2);< / div >
< div class = "line" > < a name = "l00295" > < / a > < span class = "lineno" > 295< / span >   < / div >
< div class = "line" > < a name = "l00296" > < / a > < span class = "lineno" > 296< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#a6ff38afe4720527c9513139cbab460af" > poly_add< / a > (& poly3, poly1, poly2); < span class = "comment" > // Adding the two polynomials< / span > < / div >
< div class = "line" > < a name = "l00297" > < / a > < span class = "lineno" > 297< / span >   printf(< span class = "stringliteral" > " \nResultant polynomial:\n" < / span > );< / div >
< div class = "line" > < a name = "l00298" > < / a > < span class = "lineno" > 298< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#ab9b9bedcb99f279d491d1b856791a36d" > display_polynomial< / a > (poly3);< / div >
< div class = "line" > < a name = "l00299" > < / a > < span class = "lineno" > 299< / span >   printf(< span class = "stringliteral" > " \n" < / span > );< / div >
< div class = "line" > < a name = "l00300" > < / a > < span class = "lineno" > 300< / span >   < / div >
< div class = "line" > < a name = "l00301" > < / a > < span class = "lineno" > 301< / span >   < span class = "comment" > // Frees memory space< / span > < / div >
< div class = "line" > < a name = "l00302" > < / a > < span class = "lineno" > 302< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#a5a103fff33166d6e4d975b8b63c6e895" > free_poly< / a > (poly1);< / div >
< div class = "line" > < a name = "l00303" > < / a > < span class = "lineno" > 303< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#a5a103fff33166d6e4d975b8b63c6e895" > free_poly< / a > (poly2);< / div >
< div class = "line" > < a name = "l00304" > < / a > < span class = "lineno" > 304< / span >   < a class = "code" href = "../../d0/dcb/poly__add_8c.html#a5a103fff33166d6e4d975b8b63c6e895" > free_poly< / a > (poly3);< / div >
< div class = "line" > < a name = "l00305" > < / a > < span class = "lineno" > 305< / span >   }< / div >
< / div > <!-- fragment --> < div class = "dynheader" >
Here is the call graph for this function:< / div >
< div class = "dyncontent" >
< div class = "center" > < iframe scrolling = "no" frameborder = "0" src = "../../d0/dcb/poly__add_8c_ab138609c765e2fd8b89e9c107cd40d57_cgraph.svg" width = "242" height = "190" > < p > < b > This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.< / b > < / p > < / iframe >
< / div >
< / div >
< / div >
< / div >
< / div > <!-- contents -->
< / div > <!-- doc - content -->
<!-- start footer part -->
< div id = "nav-path" class = "navpath" > <!-- id is needed for treeview function! -->
< ul >
< li class = "navelem" > < a class = "el" href = "../../dir_a52f4d3d586a58b02f3a4ddf0a992157.html" > misc< / a > < / li > < li class = "navelem" > < a class = "el" href = "../../d0/dcb/poly__add_8c.html" > poly_add.c< / a > < / li >
2021-02-06 03:52:57 +08:00
< li class = "footer" > Generated by < a href = "https://www.doxygen.org/index.html" > < img class = "footer" src = "../../doxygen.svg" width = "104" height = "31" alt = "doxygen" / > < / a > 1.9.1 < / li >
2020-09-19 01:26:09 +08:00
< / ul >
< / div >
< / body >
< / html >