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" / >
2021-10-26 03:34:27 +08:00
< meta http-equiv = "X-UA-Compatible" content = "IE=11" / >
2022-01-15 04:11:27 +08:00
< meta name = "generator" content = "Doxygen 1.9.3" / >
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" >
2021-10-26 03:34:27 +08:00
MathJax.Hub.Config({
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
jax: ["input/TeX","output/HTML-CSS"],
2020-09-19 01:26:09 +08:00
});
< / 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 >
2022-01-15 04:11:27 +08:00
< tr id = "projectrow" >
< td id = "projectalign" >
2021-10-26 03:34:27 +08:00
< div id = "projectname" > Algorithms_in_C< span id = "projectnumber" >   1.0.0< / span >
2020-09-19 01:26:09 +08:00
< / div >
< div id = "projectbrief" > Set of algorithms implemented in C.< / div >
< / td >
< / tr >
< / tbody >
< / table >
< / div >
<!-- end header part -->
2022-01-15 04:11:27 +08:00
<!-- Generated by Doxygen 1.9.3 -->
2020-09-19 01:26:09 +08:00
< script type = "text/javascript" >
2021-10-26 03:34:27 +08:00
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699& dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "../../search",'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" >
2021-10-26 03:34:27 +08:00
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699& dn=expat.txt MIT */
2020-09-19 01:26:09 +08:00
$(function() {
initMenu('../../',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
2021-10-26 03:34:27 +08:00
/* @license-end */
< / script >
2020-09-19 01:26:09 +08:00
< 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" >
2021-10-26 03:34:27 +08:00
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699& dn=expat.txt MIT */
2020-09-19 01:26:09 +08:00
$(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 >
2021-10-26 03:34:27 +08:00
< div class = "headertitle" > < div class = "title" > poly_add.c File Reference< / div > < / div >
2020-09-19 01:26:09 +08:00
< / div > <!-- header -->
< div class = "contents" >
2022-01-15 04:11:27 +08:00
< p > Implementation of [Addition of two polynomials] (< a href = "https://en.wikipedia.org/wiki/Polynomial#Addition" > https://en.wikipedia.org/wiki/Polynomial#Addition< / a > )
2020-09-19 01:26:09 +08:00
< 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" >
2021-10-26 03:34:27 +08:00
< tr class = "heading" > < td colspan = "2" > < h2 class = "groupheader" > < a id = "nested-classes" name = "nested-classes" > < / a >
2020-09-19 01:26:09 +08:00
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" >
2021-10-26 03:34:27 +08:00
< tr class = "heading" > < td colspan = "2" > < h2 class = "groupheader" > < a id = "func-members" name = "func-members" > < / a >
2020-09-19 01:26:09 +08:00
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 >
2022-01-15 04:11:27 +08:00
< div class = "textblock" > < p > Implementation of [Addition of two polynomials] (< a href = "https://en.wikipedia.org/wiki/Polynomial#Addition" > https://en.wikipedia.org/wiki/Polynomial#Addition< / a > ) < / p >
2021-10-26 03:34:27 +08:00
< dl class = "section author" > < dt > Author< / dt > < dd > < a href = "https://github.com/Ankita19ms0010" target = "_blank" > Ankita Roy Chowdhury< / a > < / dd > < / dl >
2021-02-06 03:52:57 +08:00
< 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 >
2021-10-26 03:34:27 +08:00
< a id = "a29eace09ec1373a92003075f1c2f6d9d" name = "a29eace09ec1373a92003075f1c2f6d9d" > < / a >
2020-09-19 01:26:09 +08:00
< 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 >
2022-01-15 04:11:27 +08:00
< div class = "fragment" > < div class = "line" > < span class = "lineno" > 55< / span > {< / div >
< div class = "line" > < span class = "lineno" > 56< / span > < span class = "comment" > // Creating the polynomial using temporary linked lists< / span > < / div >
< div class = "line" > < span class = "lineno" > 57< / span > < span class = "keyword" > struct < / span > < a class = "code hl_struct" href = "../../df/d86/structterm.html" > term< / a > *temp1, *temp2;< / div >
< div class = "line" > < span class = "lineno" > 58< / span > temp1 = *poly; < span class = "comment" > // Contains the null pointer< / span > < / div >
< div class = "line" > < span class = "lineno" > 59< / span > < / div >
< div class = "line" > < span class = "lineno" > 60< / span > < span class = "comment" > // Initiating first term< / span > < / div >
< div class = "line" > < span class = "lineno" > 61< / span > < span class = "keywordflow" > if< / span > (temp1 == NULL)< / div >
< div class = "line" > < span class = "lineno" > 62< / span > {< / div >
< div class = "line" > < span class = "lineno" > 63< / span > temp2 = (< span class = "keyword" > struct < / span > < a class = "code hl_struct" href = "../../df/d86/structterm.html" > term< / a > *)< a class = "code hl_define" href = "../../d2/ddd/malloc__dbg_8h.html#a725f50ecaf1959d96de79b36b4788fee" > malloc< / a > (< / div >
< div class = "line" > < span class = "lineno" > 64< / span > < span class = "keyword" > sizeof< / span > (< span class = "keyword" > struct< / span > < a class = "code hl_struct" href = "../../df/d86/structterm.html" > term< / a > )); < span class = "comment" > // Dynamic node creation< / span > < / div >
< div class = "line" > < span class = "lineno" > 65< / span > temp2-> < a class = "code hl_variable" href = "../../df/d86/structterm.html#a5a730814391f70179da78c657e6e6f7b" > coef< / a > = < a class = "code hl_variable" href = "../../df/d86/structterm.html#a5a730814391f70179da78c657e6e6f7b" > coef< / a > ;< / div >
< div class = "line" > < span class = "lineno" > 66< / span > temp2-> < a class = "code hl_variable" href = "../../df/d86/structterm.html#a057f161d279d856d11786aa96fc87f74" > pow< / a > = < a class = "code hl_variable" href = "../../df/d86/structterm.html#a057f161d279d856d11786aa96fc87f74" > pow< / a > ;< / div >
< div class = "line" > < 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" > < span class = "lineno" > 68< / span > < span class = "comment" > // polynomial just created< / span > < / div >
< div class = "line" > < span class = "lineno" > 69< / span > *poly = temp2;< / div >
< div class = "line" > < span class = "lineno" > 70< / span > temp2-> < a class = "code hl_variable" href = "../../df/d86/structterm.html#ab7ac49a58cc431c9838c855bf59a243a" > next< / a > = NULL; < span class = "comment" > // Increasing the pointer temp2< / span > < / div >
< div class = "line" > < span class = "lineno" > 71< / span > }< / div >
< div class = "line" > < span class = "lineno" > 72< / span > < span class = "comment" > // Creating the rest of the nodes< / span > < / div >
< div class = "line" > < span class = "lineno" > 73< / span > < span class = "keywordflow" > else< / span > < / div >
< div class = "line" > < span class = "lineno" > 74< / span > {< / div >
< div class = "line" > < span class = "lineno" > 75< / span > temp2-> < a class = "code hl_variable" href = "../../df/d86/structterm.html#ab7ac49a58cc431c9838c855bf59a243a" > next< / a > = (< span class = "keyword" > struct < / span > < a class = "code hl_struct" href = "../../df/d86/structterm.html" > term< / a > *)< a class = "code hl_define" href = "../../d2/ddd/malloc__dbg_8h.html#a725f50ecaf1959d96de79b36b4788fee" > malloc< / a > (< / div >
< div class = "line" > < span class = "lineno" > 76< / span > < span class = "keyword" > sizeof< / span > (< span class = "keyword" > struct< / span > < a class = "code hl_struct" href = "../../df/d86/structterm.html" > term< / a > )); < span class = "comment" > // Dynamic node creation< / span > < / div >
< div class = "line" > < span class = "lineno" > 77< / span > temp2 = temp2-> < a class = "code hl_variable" href = "../../df/d86/structterm.html#ab7ac49a58cc431c9838c855bf59a243a" > next< / a > ; < span class = "comment" > // Increasing the pointer temp2< / span > < / div >
< div class = "line" > < span class = "lineno" > 78< / span > temp2-> < a class = "code hl_variable" href = "../../df/d86/structterm.html#a5a730814391f70179da78c657e6e6f7b" > coef< / a > = < a class = "code hl_variable" href = "../../df/d86/structterm.html#a5a730814391f70179da78c657e6e6f7b" > coef< / a > ;< / div >
< div class = "line" > < span class = "lineno" > 79< / span > temp2-> < a class = "code hl_variable" href = "../../df/d86/structterm.html#a057f161d279d856d11786aa96fc87f74" > pow< / a > = < a class = "code hl_variable" href = "../../df/d86/structterm.html#a057f161d279d856d11786aa96fc87f74" > pow< / a > ;< / div >
< div class = "line" > < span class = "lineno" > 80< / span > temp2-> < a class = "code hl_variable" href = "../../df/d86/structterm.html#ab7ac49a58cc431c9838c855bf59a243a" > next< / a > = NULL;< / div >
< div class = "line" > < span class = "lineno" > 81< / span > }< / div >
< div class = "line" > < span class = "lineno" > 82< / span > }< / div >
2021-02-18 06:41:16 +08:00
< div class = "ttc" id = "amalloc__dbg_8h_html_a725f50ecaf1959d96de79b36b4788fee" > < div class = "ttname" > < a href = "../../d2/ddd/malloc__dbg_8h.html#a725f50ecaf1959d96de79b36b4788fee" > malloc< / a > < / div > < div class = "ttdeci" > #define malloc(bytes)< / div > < div class = "ttdoc" > This macro replace the standard malloc function with malloc_dbg.< / div > < div class = "ttdef" > < b > Definition:< / b > malloc_dbg.h:18< / div > < / 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 >
2021-10-26 03:34:27 +08:00
< a id = "ab9b9bedcb99f279d491d1b856791a36d" name = "ab9b9bedcb99f279d491d1b856791a36d" > < / a >
2020-09-19 01:26:09 +08:00
< 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 >
2022-01-15 04:11:27 +08:00
< div class = "fragment" > < div class = "line" > < span class = "lineno" > 183< / span > {< / div >
< div class = "line" > < span class = "lineno" > 184< / span > < span class = "keywordflow" > while< / span > (poly != NULL)< / div >
< div class = "line" > < span class = "lineno" > 185< / span > {< / div >
< div class = "line" > < span class = "lineno" > 186< / span > printf(< span class = "stringliteral" > " %d x^%d" < / span > , poly-> < a class = "code hl_variable" href = "../../df/d86/structterm.html#a5a730814391f70179da78c657e6e6f7b" > coef< / a > , poly-> < a class = "code hl_variable" href = "../../df/d86/structterm.html#a057f161d279d856d11786aa96fc87f74" > pow< / a > );< / div >
< div class = "line" > < span class = "lineno" > 187< / span > poly = poly-> < a class = "code hl_variable" href = "../../df/d86/structterm.html#ab7ac49a58cc431c9838c855bf59a243a" > next< / a > ;< / div >
< div class = "line" > < span class = "lineno" > 188< / span > < span class = "keywordflow" > if< / span > (poly != NULL)< / div >
< div class = "line" > < span class = "lineno" > 189< / span > {< / div >
< div class = "line" > < span class = "lineno" > 190< / span > printf(< span class = "stringliteral" > " + " < / span > );< / div >
< div class = "line" > < span class = "lineno" > 191< / span > }< / div >
< div class = "line" > < span class = "lineno" > 192< / span > }< / div >
< div class = "line" > < span class = "lineno" > 193< / span > }< / div >
2020-09-19 01:26:09 +08:00
< / div > <!-- fragment -->
< / div >
< / div >
2021-10-26 03:34:27 +08:00
< a id = "a5a103fff33166d6e4d975b8b63c6e895" name = "a5a103fff33166d6e4d975b8b63c6e895" > < / a >
2020-09-19 01:26:09 +08:00
< 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 >
2022-01-15 04:11:27 +08:00
< div class = "fragment" > < div class = "line" > < span class = "lineno" > 32< / span > {< / div >
< div class = "line" > < span class = "lineno" > 33< / span > < span class = "keywordflow" > if< / span > (!poly)< / div >
< div class = "line" > < span class = "lineno" > 34< / span > {< / div >
< div class = "line" > < span class = "lineno" > 35< / span > < span class = "keywordflow" > return< / span > ; < span class = "comment" > // NULL pointer does not need delete< / span > < / div >
< div class = "line" > < span class = "lineno" > 36< / span > }< / div >
< div class = "line" > < span class = "lineno" > 37< / span > < span class = "keywordflow" > else< / span > < / div >
< div class = "line" > < span class = "lineno" > 38< / span > {< / div >
< div class = "line" > < span class = "lineno" > 39< / span > < span class = "keywordflow" > while< / span > (!poly-> < a class = "code hl_variable" href = "../../df/d86/structterm.html#ab7ac49a58cc431c9838c855bf59a243a" > next< / a > )< / div >
< div class = "line" > < span class = "lineno" > 40< / span > {< / div >
< div class = "line" > < span class = "lineno" > 41< / span > < a class = "code hl_define" href = "../../d2/ddd/malloc__dbg_8h.html#a9cc854374299a1dd933bf62029761768" > free< / a > (poly-> < a class = "code hl_variable" href = "../../df/d86/structterm.html#ab7ac49a58cc431c9838c855bf59a243a" > next< / a > ); < span class = "comment" > // Deletes next term< / span > < / div >
< div class = "line" > < span class = "lineno" > 42< / span > }< / div >
< div class = "line" > < span class = "lineno" > 43< / span > < a class = "code hl_define" href = "../../d2/ddd/malloc__dbg_8h.html#a9cc854374299a1dd933bf62029761768" > free< / a > (poly); < span class = "comment" > // delete the current term< / span > < / div >
< div class = "line" > < span class = "lineno" > 44< / span > }< / div >
< div class = "line" > < span class = "lineno" > 45< / span > }< / div >
2021-02-18 06:41:16 +08:00
< div class = "ttc" id = "amalloc__dbg_8h_html_a9cc854374299a1dd933bf62029761768" > < div class = "ttname" > < a href = "../../d2/ddd/malloc__dbg_8h.html#a9cc854374299a1dd933bf62029761768" > free< / a > < / div > < div class = "ttdeci" > #define free(ptr)< / div > < div class = "ttdoc" > This macro replace the standard free function with free_dbg.< / div > < div class = "ttdef" > < b > Definition:< / b > malloc_dbg.h:26< / div > < / div >
2020-09-19 01:26:09 +08:00
< / div > <!-- fragment -->
< / div >
< / div >
2021-10-26 03:34:27 +08:00
< a id = "a840291bc02cba5474a4cb46a9b9566fe" name = "a840291bc02cba5474a4cb46a9b9566fe" > < / a >
2020-09-19 01:26:09 +08:00
< 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 >
2022-01-15 04:11:27 +08:00
< div class = "fragment" > < div class = "line" > < span class = "lineno" > 312< / span > {< / div >
< div class = "line" > < span class = "lineno" > 313< / span > < span class = "keyword" > struct < / span > < a class = "code hl_struct" href = "../../df/d86/structterm.html" > term< / a > *poly1 = NULL, *poly2 = NULL, *poly3 = NULL;< / div >
< div class = "line" > < span class = "lineno" > 314< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#ab215107dbb50c7efa811a687ce9b95af" > test1< / a > (poly1, poly2, poly3);< / div >
< div class = "line" > < span class = "lineno" > 315< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#a0c5173884bd798a6ca6f437b9b932409" > test2< / a > (poly1, poly2, poly3);< / div >
< div class = "line" > < span class = "lineno" > 316< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#ab138609c765e2fd8b89e9c107cd40d57" > test3< / a > (poly1, poly2, poly3);< / div >
< div class = "line" > < span class = "lineno" > 317< / span > < / div >
< div class = "line" > < span class = "lineno" > 318< / span > < span class = "keywordflow" > return< / span > 0;< / div >
< div class = "line" > < 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" >
2021-12-10 01:57:52 +08:00
< 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 >
2020-09-19 01:26:09 +08:00
< / div >
< / div >
< / div >
< / div >
2021-10-26 03:34:27 +08:00
< a id = "a6ff38afe4720527c9513139cbab460af" name = "a6ff38afe4720527c9513139cbab460af" > < / a >
2020-09-19 01:26:09 +08:00
< 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 >
2022-01-15 04:11:27 +08:00
< div class = "fragment" > < div class = "line" > < span class = "lineno" > 92< / span > {< / div >
< div class = "line" > < span class = "lineno" > 93< / span > < span class = "comment" > // Creating a temporary linked list to store the resultant polynomial< / span > < / div >
< div class = "line" > < span class = "lineno" > 94< / span > < span class = "keyword" > struct < / span > < a class = "code hl_struct" href = "../../df/d86/structterm.html" > term< / a > *temp = (< span class = "keyword" > struct < / span > < a class = "code hl_struct" href = "../../df/d86/structterm.html" > term< / a > *)< a class = "code hl_define" href = "../../d2/ddd/malloc__dbg_8h.html#a725f50ecaf1959d96de79b36b4788fee" > malloc< / a > (< span class = "keyword" > sizeof< / span > (< span class = "keyword" > struct< / span > < a class = "code hl_struct" href = "../../df/d86/structterm.html" > term< / a > ));< / div >
< div class = "line" > < span class = "lineno" > 95< / span > temp-> next = NULL;< / div >
< div class = "line" > < span class = "lineno" > 96< / span > *pol =< / div >
< div class = "line" > < 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" > < span class = "lineno" > 98< / span > < / div >
< div class = "line" > < span class = "lineno" > 99< / span > < span class = "comment" > // Comparing the powers of the nodes of both the polynomials< / span > < / div >
< div class = "line" > < span class = "lineno" > 100< / span > < span class = "comment" > // until one gets exhausted< / span > < / div >
< div class = "line" > < span class = "lineno" > 101< / span > < span class = "keywordflow" > while< / span > (poly1 & & poly2)< / div >
< div class = "line" > < span class = "lineno" > 102< / span > {< / div >
< div class = "line" > < 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" > < 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" > < span class = "lineno" > 105< / span > < span class = "comment" > polynomial in temp and increase the pointer poly1< / span > < / div >
< div class = "line" > < span class = "lineno" > 106< / span > < span class = "comment" > */< / span > < / div >
< div class = "line" > < span class = "lineno" > 107< / span > < span class = "keywordflow" > if< / span > (poly1-> < a class = "code hl_variable" href = "../../df/d86/structterm.html#a057f161d279d856d11786aa96fc87f74" > pow< / a > > poly2-> < a class = "code hl_variable" href = "../../df/d86/structterm.html#a057f161d279d856d11786aa96fc87f74" > pow< / a > )< / div >
< div class = "line" > < span class = "lineno" > 108< / span > {< / div >
< div class = "line" > < span class = "lineno" > 109< / span > temp-> coef = poly1-> < a class = "code hl_variable" href = "../../df/d86/structterm.html#a5a730814391f70179da78c657e6e6f7b" > coef< / a > ;< / div >
< div class = "line" > < span class = "lineno" > 110< / span > temp-> pow = poly1-> < a class = "code hl_variable" href = "../../df/d86/structterm.html#a057f161d279d856d11786aa96fc87f74" > pow< / a > ;< / div >
< div class = "line" > < span class = "lineno" > 111< / span > poly1 = poly1-> < a class = "code hl_variable" href = "../../df/d86/structterm.html#ab7ac49a58cc431c9838c855bf59a243a" > next< / a > ;< / div >
< div class = "line" > < span class = "lineno" > 112< / span > }< / div >
< div class = "line" > < 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" > < 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" > < span class = "lineno" > 115< / span > < span class = "comment" > second polynomial in temp and increase the pointer poly2< / span > < / div >
< div class = "line" > < span class = "lineno" > 116< / span > < span class = "comment" > */< / span > < / div >
< div class = "line" > < span class = "lineno" > 117< / span > < span class = "keywordflow" > else< / span > < span class = "keywordflow" > if< / span > (poly1-> < a class = "code hl_variable" href = "../../df/d86/structterm.html#a057f161d279d856d11786aa96fc87f74" > pow< / a > < poly2-> < a class = "code hl_variable" href = "../../df/d86/structterm.html#a057f161d279d856d11786aa96fc87f74" > pow< / a > )< / div >
< div class = "line" > < span class = "lineno" > 118< / span > {< / div >
< div class = "line" > < span class = "lineno" > 119< / span > temp-> coef = poly2-> < a class = "code hl_variable" href = "../../df/d86/structterm.html#a5a730814391f70179da78c657e6e6f7b" > coef< / a > ;< / div >
< div class = "line" > < span class = "lineno" > 120< / span > temp-> pow = poly2-> < a class = "code hl_variable" href = "../../df/d86/structterm.html#a057f161d279d856d11786aa96fc87f74" > pow< / a > ;< / div >
< div class = "line" > < span class = "lineno" > 121< / span > poly2 = poly2-> < a class = "code hl_variable" href = "../../df/d86/structterm.html#ab7ac49a58cc431c9838c855bf59a243a" > next< / a > ;< / div >
< div class = "line" > < span class = "lineno" > 122< / span > }< / div >
< div class = "line" > < span class = "lineno" > 123< / span > < span class = "comment" > /* If both of them have same power then sum the coefficients< / span > < / div >
< div class = "line" > < span class = "lineno" > 124< / span > < span class = "comment" > place both the summed coefficient and the power in temp< / span > < / div >
< div class = "line" > < span class = "lineno" > 125< / span > < span class = "comment" > increase both the pointers poly1 and poly2< / span > < / div >
< div class = "line" > < span class = "lineno" > 126< / span > < span class = "comment" > */< / span > < / div >
< div class = "line" > < span class = "lineno" > 127< / span > < span class = "keywordflow" > else< / span > < / div >
< div class = "line" > < span class = "lineno" > 128< / span > {< / div >
< div class = "line" > < span class = "lineno" > 129< / span > temp-> coef = poly1-> < a class = "code hl_variable" href = "../../df/d86/structterm.html#a5a730814391f70179da78c657e6e6f7b" > coef< / a > + poly2-> < a class = "code hl_variable" href = "../../df/d86/structterm.html#a5a730814391f70179da78c657e6e6f7b" > coef< / a > ;< / div >
< div class = "line" > < span class = "lineno" > 130< / span > temp-> pow = poly1-> < a class = "code hl_variable" href = "../../df/d86/structterm.html#a057f161d279d856d11786aa96fc87f74" > pow< / a > ;< / div >
< div class = "line" > < span class = "lineno" > 131< / span > poly1 = poly1-> < a class = "code hl_variable" href = "../../df/d86/structterm.html#ab7ac49a58cc431c9838c855bf59a243a" > next< / a > ;< / div >
< div class = "line" > < span class = "lineno" > 132< / span > poly2 = poly2-> < a class = "code hl_variable" href = "../../df/d86/structterm.html#ab7ac49a58cc431c9838c855bf59a243a" > next< / a > ;< / div >
< div class = "line" > < span class = "lineno" > 133< / span > }< / div >
< div class = "line" > < span class = "lineno" > 134< / span > < span class = "comment" > /* If none of the polynomials are exhausted< / span > < / div >
< div class = "line" > < span class = "lineno" > 135< / span > < span class = "comment" > dynamically create a node in temp< / span > < / div >
< div class = "line" > < span class = "lineno" > 136< / span > < span class = "comment" > */< / span > < / div >
< div class = "line" > < span class = "lineno" > 137< / span > < span class = "keywordflow" > if< / span > (poly1 & & poly2)< / div >
< div class = "line" > < span class = "lineno" > 138< / span > {< / div >
< div class = "line" > < span class = "lineno" > 139< / span > temp-> next = (< span class = "keyword" > struct < / span > < a class = "code hl_struct" href = "../../df/d86/structterm.html" > term< / a > *)< a class = "code hl_define" href = "../../d2/ddd/malloc__dbg_8h.html#a725f50ecaf1959d96de79b36b4788fee" > malloc< / a > (< / div >
< div class = "line" > < span class = "lineno" > 140< / span > < span class = "keyword" > sizeof< / span > (< span class = "keyword" > struct< / span > < a class = "code hl_struct" href = "../../df/d86/structterm.html" > term< / a > )); < span class = "comment" > // Dynamic node creation< / span > < / div >
< div class = "line" > < span class = "lineno" > 141< / span > temp = temp-> next; < span class = "comment" > // Increase the pointer temp< / span > < / div >
< div class = "line" > < span class = "lineno" > 142< / span > temp-> next = NULL;< / div >
< div class = "line" > < span class = "lineno" > 143< / span > }< / div >
< div class = "line" > < span class = "lineno" > 144< / span > }< / div >
< div class = "line" > < span class = "lineno" > 145< / span > < span class = "comment" > /* If one of the polynomials is exhausted< / span > < / div >
< div class = "line" > < 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" > < span class = "lineno" > 147< / span > < span class = "comment" > by creating nodes dynamically< / span > < / div >
< div class = "line" > < span class = "lineno" > 148< / span > < span class = "comment" > */< / span > < / div >
< div class = "line" > < span class = "lineno" > 149< / span > < span class = "keywordflow" > while< / span > (poly1 || poly2)< / div >
< div class = "line" > < span class = "lineno" > 150< / span > {< / div >
< div class = "line" > < span class = "lineno" > 151< / span > temp-> next = (< span class = "keyword" > struct < / span > < a class = "code hl_struct" href = "../../df/d86/structterm.html" > term< / a > *)< a class = "code hl_define" href = "../../d2/ddd/malloc__dbg_8h.html#a725f50ecaf1959d96de79b36b4788fee" > malloc< / a > (< / div >
< div class = "line" > < span class = "lineno" > 152< / span > < span class = "keyword" > sizeof< / span > (< span class = "keyword" > struct< / span > < a class = "code hl_struct" href = "../../df/d86/structterm.html" > term< / a > )); < span class = "comment" > // Dynamic node creation< / span > < / div >
< div class = "line" > < span class = "lineno" > 153< / span > temp = temp-> next; < span class = "comment" > // Increasing the pointer< / span > < / div >
< div class = "line" > < span class = "lineno" > 154< / span > temp-> next = NULL;< / div >
< div class = "line" > < span class = "lineno" > 155< / span > < / div >
< div class = "line" > < span class = "lineno" > 156< / span > < span class = "comment" > /* If poly1 is not exhausted< / span > < / div >
< div class = "line" > < span class = "lineno" > 157< / span > < span class = "comment" > place rest of that polynomial in temp< / span > < / div >
< div class = "line" > < span class = "lineno" > 158< / span > < span class = "comment" > */< / span > < / div >
< div class = "line" > < span class = "lineno" > 159< / span > < span class = "keywordflow" > if< / span > (poly1)< / div >
< div class = "line" > < span class = "lineno" > 160< / span > {< / div >
< div class = "line" > < span class = "lineno" > 161< / span > temp-> coef = poly1-> < a class = "code hl_variable" href = "../../df/d86/structterm.html#a5a730814391f70179da78c657e6e6f7b" > coef< / a > ;< / div >
< div class = "line" > < span class = "lineno" > 162< / span > temp-> pow = poly1-> < a class = "code hl_variable" href = "../../df/d86/structterm.html#a057f161d279d856d11786aa96fc87f74" > pow< / a > ;< / div >
< div class = "line" > < span class = "lineno" > 163< / span > poly1 = poly1-> < a class = "code hl_variable" href = "../../df/d86/structterm.html#ab7ac49a58cc431c9838c855bf59a243a" > next< / a > ;< / div >
< div class = "line" > < span class = "lineno" > 164< / span > }< / div >
< div class = "line" > < span class = "lineno" > 165< / span > < span class = "comment" > /* If poly2 is not exhausted< / span > < / div >
< div class = "line" > < span class = "lineno" > 166< / span > < span class = "comment" > place rest of that polynomial in temp< / span > < / div >
< div class = "line" > < span class = "lineno" > 167< / span > < span class = "comment" > */< / span > < / div >
< div class = "line" > < span class = "lineno" > 168< / span > < span class = "keywordflow" > else< / span > < span class = "keywordflow" > if< / span > (poly2)< / div >
< div class = "line" > < span class = "lineno" > 169< / span > {< / div >
< div class = "line" > < span class = "lineno" > 170< / span > temp-> coef = poly2-> < a class = "code hl_variable" href = "../../df/d86/structterm.html#a5a730814391f70179da78c657e6e6f7b" > coef< / a > ;< / div >
< div class = "line" > < span class = "lineno" > 171< / span > temp-> pow = poly2-> < a class = "code hl_variable" href = "../../df/d86/structterm.html#a057f161d279d856d11786aa96fc87f74" > pow< / a > ;< / div >
< div class = "line" > < span class = "lineno" > 172< / span > poly2 = poly2-> < a class = "code hl_variable" href = "../../df/d86/structterm.html#ab7ac49a58cc431c9838c855bf59a243a" > next< / a > ;< / div >
< div class = "line" > < span class = "lineno" > 173< / span > }< / div >
< div class = "line" > < span class = "lineno" > 174< / span > }< / div >
< div class = "line" > < span class = "lineno" > 175< / span > }< / div >
2020-09-19 01:26:09 +08:00
< / div > <!-- fragment -->
< / div >
< / div >
2021-10-26 03:34:27 +08:00
< a id = "ab215107dbb50c7efa811a687ce9b95af" name = "ab215107dbb50c7efa811a687ce9b95af" > < / a >
2020-09-19 01:26:09 +08:00
< 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 >
2021-10-26 03:34:27 +08:00
< 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 >
2022-01-15 04:11:27 +08:00
< div class = "fragment" > < div class = "line" > < span class = "lineno" > 205< / span > {< / div >
< div class = "line" > < span class = "lineno" > 206< / span > printf(< span class = "stringliteral" > " \n----Test 1----\n" < / span > );< / div >
< div class = "line" > < 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" > < span class = "lineno" > 208< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly1, 5, 2);< / div >
< div class = "line" > < span class = "lineno" > 209< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly1, 3, 1);< / div >
< div class = "line" > < span class = "lineno" > 210< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly1, 2, 0);< / div >
< div class = "line" > < span class = "lineno" > 211< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#ab9b9bedcb99f279d491d1b856791a36d" > display_polynomial< / a > (poly1);< / div >
< div class = "line" > < span class = "lineno" > 212< / span > < / div >
< div class = "line" > < 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" > < span class = "lineno" > 214< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly2, 7, 3);< / div >
< div class = "line" > < span class = "lineno" > 215< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly2, 9, 1);< / div >
< div class = "line" > < span class = "lineno" > 216< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly2, 10, 0);< / div >
< div class = "line" > < span class = "lineno" > 217< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#ab9b9bedcb99f279d491d1b856791a36d" > display_polynomial< / a > (poly2);< / div >
< div class = "line" > < span class = "lineno" > 218< / span > < / div >
< div class = "line" > < span class = "lineno" > 219< / span > < a class = "code hl_function" 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" > < span class = "lineno" > 220< / span > printf(< span class = "stringliteral" > " \nResultant polynomial:\n" < / span > );< / div >
< div class = "line" > < span class = "lineno" > 221< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#ab9b9bedcb99f279d491d1b856791a36d" > display_polynomial< / a > (poly3);< / div >
< div class = "line" > < span class = "lineno" > 222< / span > printf(< span class = "stringliteral" > " \n" < / span > );< / div >
< div class = "line" > < span class = "lineno" > 223< / span > < / div >
< div class = "line" > < span class = "lineno" > 224< / span > < span class = "comment" > // Frees memory space< / span > < / div >
< div class = "line" > < span class = "lineno" > 225< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#a5a103fff33166d6e4d975b8b63c6e895" > free_poly< / a > (poly1);< / div >
< div class = "line" > < span class = "lineno" > 226< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#a5a103fff33166d6e4d975b8b63c6e895" > free_poly< / a > (poly2);< / div >
< div class = "line" > < span class = "lineno" > 227< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#a5a103fff33166d6e4d975b8b63c6e895" > free_poly< / a > (poly3);< / div >
< div class = "line" > < 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" >
2021-12-10 01:57:52 +08:00
< 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 >
2020-09-19 01:26:09 +08:00
< / div >
< / div >
< / div >
< / div >
2021-10-26 03:34:27 +08:00
< a id = "a0c5173884bd798a6ca6f437b9b932409" name = "a0c5173884bd798a6ca6f437b9b932409" > < / a >
2020-09-19 01:26:09 +08:00
< 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 >
2021-10-26 03:34:27 +08:00
< 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 >
2022-01-15 04:11:27 +08:00
< div class = "fragment" > < div class = "line" > < span class = "lineno" > 240< / span > {< / div >
< div class = "line" > < span class = "lineno" > 241< / span > printf(< span class = "stringliteral" > " \n----Test 2----\n" < / span > );< / div >
< div class = "line" > < 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" > < span class = "lineno" > 243< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly1, 3, 5);< / div >
< div class = "line" > < span class = "lineno" > 244< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly1, 1, 4);< / div >
< div class = "line" > < span class = "lineno" > 245< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly1, 2, 3);< / div >
< div class = "line" > < span class = "lineno" > 246< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly1, -2, 1);< / div >
< div class = "line" > < span class = "lineno" > 247< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly1, 5, 0);< / div >
< div class = "line" > < span class = "lineno" > 248< / span > < / div >
< div class = "line" > < span class = "lineno" > 249< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#ab9b9bedcb99f279d491d1b856791a36d" > display_polynomial< / a > (poly1);< / div >
< div class = "line" > < span class = "lineno" > 250< / span > < / div >
< div class = "line" > < 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" > < span class = "lineno" > 252< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly2, 2, 5);< / div >
< div class = "line" > < span class = "lineno" > 253< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly2, 3, 3);< / div >
< div class = "line" > < span class = "lineno" > 254< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly2, 7, 1);< / div >
< div class = "line" > < span class = "lineno" > 255< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly2, 2, 0);< / div >
< div class = "line" > < span class = "lineno" > 256< / span > < / div >
< div class = "line" > < span class = "lineno" > 257< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#ab9b9bedcb99f279d491d1b856791a36d" > display_polynomial< / a > (poly2);< / div >
< div class = "line" > < span class = "lineno" > 258< / span > < / div >
< div class = "line" > < span class = "lineno" > 259< / span > < a class = "code hl_function" 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" > < span class = "lineno" > 260< / span > printf(< span class = "stringliteral" > " \nResultant polynomial:\n" < / span > );< / div >
< div class = "line" > < span class = "lineno" > 261< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#ab9b9bedcb99f279d491d1b856791a36d" > display_polynomial< / a > (poly3);< / div >
< div class = "line" > < span class = "lineno" > 262< / span > printf(< span class = "stringliteral" > " \n" < / span > );< / div >
< div class = "line" > < span class = "lineno" > 263< / span > < / div >
< div class = "line" > < span class = "lineno" > 264< / span > < span class = "comment" > // Frees memory space< / span > < / div >
< div class = "line" > < span class = "lineno" > 265< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#a5a103fff33166d6e4d975b8b63c6e895" > free_poly< / a > (poly1);< / div >
< div class = "line" > < span class = "lineno" > 266< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#a5a103fff33166d6e4d975b8b63c6e895" > free_poly< / a > (poly2);< / div >
< div class = "line" > < span class = "lineno" > 267< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#a5a103fff33166d6e4d975b8b63c6e895" > free_poly< / a > (poly3);< / div >
< div class = "line" > < span class = "lineno" > 268< / span > }< / 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" >
2021-12-10 01:57:52 +08:00
< 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 >
2020-09-19 01:26:09 +08:00
< / div >
< / div >
< / div >
< / div >
2021-10-26 03:34:27 +08:00
< a id = "ab138609c765e2fd8b89e9c107cd40d57" name = "ab138609c765e2fd8b89e9c107cd40d57" > < / a >
2020-09-19 01:26:09 +08:00
< 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 >
2021-10-26 03:34:27 +08:00
< 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 >
2022-01-15 04:11:27 +08:00
< div class = "fragment" > < div class = "line" > < span class = "lineno" > 280< / span > {< / div >
< div class = "line" > < span class = "lineno" > 281< / span > printf(< span class = "stringliteral" > " \n----Test 3----\n" < / span > );< / div >
< div class = "line" > < 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" > < span class = "lineno" > 283< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly1, -12, 0);< / div >
< div class = "line" > < span class = "lineno" > 284< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly1, 8, 1);< / div >
< div class = "line" > < span class = "lineno" > 285< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly1, 4, 3);< / div >
< div class = "line" > < span class = "lineno" > 286< / span > < / div >
< div class = "line" > < span class = "lineno" > 287< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#ab9b9bedcb99f279d491d1b856791a36d" > display_polynomial< / a > (poly1);< / div >
< div class = "line" > < span class = "lineno" > 288< / span > < / div >
< div class = "line" > < 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" > < span class = "lineno" > 290< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly2, 5, 0);< / div >
< div class = "line" > < span class = "lineno" > 291< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly2, -13, 1);< / div >
< div class = "line" > < span class = "lineno" > 292< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#a29eace09ec1373a92003075f1c2f6d9d" > create_polynomial< / a > (& poly2, 3, 3);< / div >
< div class = "line" > < span class = "lineno" > 293< / span > < / div >
< div class = "line" > < span class = "lineno" > 294< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#ab9b9bedcb99f279d491d1b856791a36d" > display_polynomial< / a > (poly2);< / div >
< div class = "line" > < span class = "lineno" > 295< / span > < / div >
< div class = "line" > < span class = "lineno" > 296< / span > < a class = "code hl_function" 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" > < span class = "lineno" > 297< / span > printf(< span class = "stringliteral" > " \nResultant polynomial:\n" < / span > );< / div >
< div class = "line" > < span class = "lineno" > 298< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#ab9b9bedcb99f279d491d1b856791a36d" > display_polynomial< / a > (poly3);< / div >
< div class = "line" > < span class = "lineno" > 299< / span > printf(< span class = "stringliteral" > " \n" < / span > );< / div >
< div class = "line" > < span class = "lineno" > 300< / span > < / div >
< div class = "line" > < span class = "lineno" > 301< / span > < span class = "comment" > // Frees memory space< / span > < / div >
< div class = "line" > < span class = "lineno" > 302< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#a5a103fff33166d6e4d975b8b63c6e895" > free_poly< / a > (poly1);< / div >
< div class = "line" > < span class = "lineno" > 303< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#a5a103fff33166d6e4d975b8b63c6e895" > free_poly< / a > (poly2);< / div >
< div class = "line" > < span class = "lineno" > 304< / span > < a class = "code hl_function" href = "../../d0/dcb/poly__add_8c.html#a5a103fff33166d6e4d975b8b63c6e895" > free_poly< / a > (poly3);< / div >
< div class = "line" > < span class = "lineno" > 305< / span > }< / 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" >
2021-12-10 01:57:52 +08:00
< 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 >
2020-09-19 01:26:09 +08:00
< / 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 >
2022-01-15 04:11:27 +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.3 < / li >
2020-09-19 01:26:09 +08:00
< / ul >
< / div >
< / body >
< / html >