2021-10-25 22:34:27 +03: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=11" / >
2022-01-14 23:11:27 +03:00
< meta name = "generator" content = "Doxygen 1.9.3" / >
2021-10-25 22:34:27 +03:00
< meta name = "viewport" content = "width=device-width, initial-scale=1" / >
< title > Algorithms_in_C: misc/postfix_evaluation.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 >
2022-01-14 23:11:27 +03:00
< tr id = "projectrow" >
< td id = "projectalign" >
2021-10-25 22:34:27 +03:00
< 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 -->
2022-01-14 23:11:27 +03:00
<!-- Generated by Doxygen 1.9.3 -->
2021-10-25 22:34:27 +03:00
< script type = "text/javascript" >
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699& dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "../../search",'Search','.html');
/* @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:d3d9a9a6595521f9666a5e94cc830dab83b65699& dn=expat.txt MIT */
$(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:d3d9a9a6595521f9666a5e94cc830dab83b65699& dn=expat.txt MIT */
$(document).ready(function(){initNavTree('df/d43/postfix__evaluation_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 > |
< a href = "#var-members" > Variables< / a > < / div >
< div class = "headertitle" > < div class = "title" > postfix_evaluation.c File Reference< / div > < / div >
< / div > <!-- header -->
< div class = "contents" >
< p > < a href = "https://www.includehelp.com/c/evaluation-of-postfix-expressions-using-stack-with-c-program.aspx" target = "_blank" > Postfix evaluation algorithm< / a > implementation
< a href = "#details" > More...< / a > < / p >
< div class = "textblock" > < code > #include < stdio.h> < / code > < br / >
< code > #include < string.h> < / code > < br / >
< code > #include < ctype.h> < / code > < br / >
< code > #include < stdlib.h> < / code > < br / >
< code > #include < stdint.h> < / code > < br / >
< code > #include < assert.h> < / code > < br / >
< / div > < div class = "textblock" > < div class = "dynheader" >
Include dependency graph for postfix_evaluation.c:< / div >
< div class = "dyncontent" >
< div class = "center" > < iframe scrolling = "no" frameborder = "0" src = "../../d4/d26/postfix__evaluation_8c__incl.svg" width = "524" 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 id = "nested-classes" 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 = "../../dd/d10/struct_stack.html" > Stack< / a > < / td > < / tr >
< tr class = "memdesc:" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > for printf() and scanf() < a href = "../../dd/d10/struct_stack.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 id = "func-members" name = "func-members" > < / a >
Functions< / h2 > < / td > < / tr >
< tr class = "memitem:af395c540f7e70a8d82d055a0aa42bbef" > < td class = "memItemLeft" align = "right" valign = "top" > void  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../df/d43/postfix__evaluation_8c.html#af395c540f7e70a8d82d055a0aa42bbef" > push< / a > (int8_t opd)< / td > < / tr >
< tr class = "memdesc:af395c540f7e70a8d82d055a0aa42bbef" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > Function to push on the stack. < a href = "../../df/d43/postfix__evaluation_8c.html#af395c540f7e70a8d82d055a0aa42bbef" > More...< / a > < br / > < / td > < / tr >
< tr class = "separator:af395c540f7e70a8d82d055a0aa42bbef" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:a8546e4b3f61be1f09ce47f428116ad7d" > < td class = "memItemLeft" align = "right" valign = "top" > int8_t  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../df/d43/postfix__evaluation_8c.html#a8546e4b3f61be1f09ce47f428116ad7d" > pop< / a > ()< / td > < / tr >
< tr class = "memdesc:a8546e4b3f61be1f09ce47f428116ad7d" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > Function to pop from the stack. < a href = "../../df/d43/postfix__evaluation_8c.html#a8546e4b3f61be1f09ce47f428116ad7d" > More...< / a > < br / > < / td > < / tr >
< tr class = "separator:a8546e4b3f61be1f09ce47f428116ad7d" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:a4494492c8fc2509f602acc8228a3b623" > < td class = "memItemLeft" align = "right" valign = "top" > int8_t  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../df/d43/postfix__evaluation_8c.html#a4494492c8fc2509f602acc8228a3b623" > evaluate< / a > (char post[])< / td > < / tr >
< tr class = "memdesc:a4494492c8fc2509f602acc8228a3b623" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > Function to evaluate postfix expression. < a href = "../../df/d43/postfix__evaluation_8c.html#a4494492c8fc2509f602acc8228a3b623" > More...< / a > < br / > < / td > < / tr >
< tr class = "separator:a4494492c8fc2509f602acc8228a3b623" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:aa8dca7b867074164d5f45b0f3851269d" > < td class = "memItemLeft" align = "right" valign = "top" > static void  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../df/d43/postfix__evaluation_8c.html#aa8dca7b867074164d5f45b0f3851269d" > test< / a > ()< / td > < / tr >
< tr class = "memdesc:aa8dca7b867074164d5f45b0f3851269d" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > Self-test implementations. < a href = "../../df/d43/postfix__evaluation_8c.html#aa8dca7b867074164d5f45b0f3851269d" > More...< / a > < br / > < / td > < / tr >
< tr class = "separator:aa8dca7b867074164d5f45b0f3851269d" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:ae66f6b31b5ad750f1fe042a706a4e3d4" > < td class = "memItemLeft" align = "right" valign = "top" > int  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../df/d43/postfix__evaluation_8c.html#ae66f6b31b5ad750f1fe042a706a4e3d4" > main< / a > ()< / td > < / tr >
< tr class = "memdesc:ae66f6b31b5ad750f1fe042a706a4e3d4" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > Main function. < a href = "../../df/d43/postfix__evaluation_8c.html#ae66f6b31b5ad750f1fe042a706a4e3d4" > More...< / a > < br / > < / td > < / tr >
< tr class = "separator:ae66f6b31b5ad750f1fe042a706a4e3d4" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< / table > < table class = "memberdecls" >
< tr class = "heading" > < td colspan = "2" > < h2 class = "groupheader" > < a id = "var-members" name = "var-members" > < / a >
Variables< / h2 > < / td > < / tr >
< tr class = "memitem:a791cc5e78425bce611db4e3bdc4b19d5" > < td class = "memItemLeft" align = "right" valign = "top" > < a id = "a791cc5e78425bce611db4e3bdc4b19d5" name = "a791cc5e78425bce611db4e3bdc4b19d5" > < / a >
struct < a class = "el" href = "../../dd/d10/struct_stack.html" > Stack< / a >   < / td > < td class = "memItemRight" valign = "bottom" > < b > st< / b > < / td > < / tr >
< tr class = "memdesc:a791cc5e78425bce611db4e3bdc4b19d5" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > global declaration of stack st < br / > < / td > < / tr >
< tr class = "separator:a791cc5e78425bce611db4e3bdc4b19d5" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< / table >
< a name = "details" id = "details" > < / a > < h2 class = "groupheader" > Detailed Description< / h2 >
< div class = "textblock" > < p > < a href = "https://www.includehelp.com/c/evaluation-of-postfix-expressions-using-stack-with-c-program.aspx" target = "_blank" > Postfix evaluation algorithm< / a > implementation < / p >
< p > The input postfix expression is of type string upto 49 characters (including space delimiters). Supported operations- '+', '-', '/', '*', '' < / p > < dl class = "section author" > < dt > Author< / dt > < dd > < a href = "https://github.com/kumaryash18" target = "_blank" > Kumar Yash< / a > < / dd > < / dl >
< / div > < h2 class = "groupheader" > Function Documentation< / h2 >
< a id = "a4494492c8fc2509f602acc8228a3b623" name = "a4494492c8fc2509f602acc8228a3b623" > < / a >
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#a4494492c8fc2509f602acc8228a3b623" > ◆ < / a > < / span > evaluate()< / h2 >
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > int8_t evaluate < / td >
< td > (< / td >
< td class = "paramtype" > char  < / td >
< td class = "paramname" > < em > post< / em > []< / td > < td > )< / td >
< td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > Function to evaluate postfix expression. < / p >
< dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > post< / td > < td > the input postfix expression < / td > < / tr >
< / table >
< / dd >
< / dl >
< dl class = "section return" > < dt > Returns< / dt > < dd > evaluated answer < / dd > < / dl >
2022-01-14 23:11:27 +03:00
< div class = "fragment" > < div class = "line" > < span class = "lineno" > 60< / span > {< / div >
< div class = "line" > < span class = "lineno" > 61< / span > int8_t it1;< / div >
< div class = "line" > < span class = "lineno" > 62< / span > int8_t it2;< / div >
< div class = "line" > < span class = "lineno" > 63< / span > int8_t temp;< / div >
< div class = "line" > < span class = "lineno" > 64< / span > int8_t number;< / div >
< div class = "line" > < span class = "lineno" > 65< / span > < span class = "keywordtype" > int< / span > i;< / div >
< div class = "line" > < span class = "lineno" > 66< / span > < span class = "keywordflow" > for< / span > (i = 0; i < strlen(post); i++) {< / div >
< div class = "line" > < span class = "lineno" > 67< / span > < span class = "keywordflow" > if< / span > (post[i] == < span class = "charliteral" > ' ' < / span > ) {< / div >
< div class = "line" > < span class = "lineno" > 68< / span > < span class = "keywordflow" > continue< / span > ; < span class = "comment" > // ignore delimiter< / span > < / div >
< div class = "line" > < span class = "lineno" > 69< / span > }< / div >
< div class = "line" > < span class = "lineno" > 70< / span > < span class = "keywordflow" > else< / span > < span class = "keywordflow" > if< / span > (isdigit(post[i])) {< / div >
< div class = "line" > < span class = "lineno" > 71< / span > number = 0;< / div >
< div class = "line" > < span class = "lineno" > 72< / span > < span class = "keywordflow" > do< / span > {< / div >
< div class = "line" > < span class = "lineno" > 73< / span > number = number * 10 + (post[i]-< span class = "charliteral" > ' 0' < / span > );< / div >
< div class = "line" > < span class = "lineno" > 74< / span > i++;< / div >
< div class = "line" > < span class = "lineno" > 75< / span > } < span class = "keywordflow" > while< / span > (i < strlen(post) & & isdigit(post[i]));< / div >
< div class = "line" > < span class = "lineno" > 76< / span > < a class = "code hl_function" href = "../../df/d43/postfix__evaluation_8c.html#af395c540f7e70a8d82d055a0aa42bbef" > push< / a > (number);< / div >
< div class = "line" > < span class = "lineno" > 77< / span > }< / div >
< div class = "line" > < span class = "lineno" > 78< / span > < span class = "keywordflow" > else< / span > {< / div >
< div class = "line" > < span class = "lineno" > 79< / span > it2 = < a class = "code hl_function" href = "../../df/d43/postfix__evaluation_8c.html#a8546e4b3f61be1f09ce47f428116ad7d" > pop< / a > ();< / div >
< div class = "line" > < span class = "lineno" > 80< / span > it1 = < a class = "code hl_function" href = "../../df/d43/postfix__evaluation_8c.html#a8546e4b3f61be1f09ce47f428116ad7d" > pop< / a > ();< / div >
< div class = "line" > < span class = "lineno" > 81< / span > < span class = "keywordflow" > switch< / span > (post[i]) {< / div >
< div class = "line" > < span class = "lineno" > 82< / span > < span class = "keywordflow" > case< / span > < span class = "charliteral" > ' +' < / span > :< / div >
< div class = "line" > < span class = "lineno" > 83< / span > temp = it1 + it2; < span class = "keywordflow" > break< / span > ;< / div >
< div class = "line" > < span class = "lineno" > 84< / span > < span class = "keywordflow" > case< / span > < span class = "charliteral" > ' -' < / span > :< / div >
< div class = "line" > < span class = "lineno" > 85< / span > temp = it1 - it2; < span class = "keywordflow" > break< / span > ;< / div >
< div class = "line" > < span class = "lineno" > 86< / span > < span class = "keywordflow" > case< / span > < span class = "charliteral" > ' *' < / span > :< / div >
< div class = "line" > < span class = "lineno" > 87< / span > temp = it1 * it2; < span class = "keywordflow" > break< / span > ;< / div >
< div class = "line" > < span class = "lineno" > 88< / span > < span class = "keywordflow" > case< / span > < span class = "charliteral" > ' /' < / span > :< / div >
< div class = "line" > < span class = "lineno" > 89< / span > temp = it1 / it2; < span class = "keywordflow" > break< / span > ;< / div >
< div class = "line" > < span class = "lineno" > 90< / span > < span class = "keywordflow" > case< / span > < span class = "charliteral" > ' %' < / span > :< / div >
< div class = "line" > < span class = "lineno" > 91< / span > temp = it1 % it2; < span class = "keywordflow" > break< / span > ;< / div >
< div class = "line" > < span class = "lineno" > 92< / span > < span class = "keywordflow" > default< / span > :< / div >
< div class = "line" > < span class = "lineno" > 93< / span > printf(< span class = "stringliteral" > " Invalid operator" < / span > ); exit(1);< / div >
< div class = "line" > < span class = "lineno" > 94< / span > }< / div >
< div class = "line" > < span class = "lineno" > 95< / span > < a class = "code hl_function" href = "../../df/d43/postfix__evaluation_8c.html#af395c540f7e70a8d82d055a0aa42bbef" > push< / a > (temp);< / div >
< div class = "line" > < span class = "lineno" > 96< / span > }< / div >
< div class = "line" > < span class = "lineno" > 97< / span > }< / div >
< div class = "line" > < span class = "lineno" > 98< / span > < span class = "keywordflow" > return< / span > < a class = "code hl_function" href = "../../df/d43/postfix__evaluation_8c.html#a8546e4b3f61be1f09ce47f428116ad7d" > pop< / a > ();< / div >
< div class = "line" > < span class = "lineno" > 99< / span > }< / div >
2021-10-25 22:34:27 +03:00
< div class = "ttc" id = "apostfix__evaluation_8c_html_a8546e4b3f61be1f09ce47f428116ad7d" > < div class = "ttname" > < a href = "../../df/d43/postfix__evaluation_8c.html#a8546e4b3f61be1f09ce47f428116ad7d" > pop< / a > < / div > < div class = "ttdeci" > int8_t pop()< / div > < div class = "ttdoc" > Function to pop from the stack.< / div > < div class = "ttdef" > < b > Definition:< / b > postfix_evaluation.c:44< / div > < / div >
< div class = "ttc" id = "apostfix__evaluation_8c_html_af395c540f7e70a8d82d055a0aa42bbef" > < div class = "ttname" > < a href = "../../df/d43/postfix__evaluation_8c.html#af395c540f7e70a8d82d055a0aa42bbef" > push< / a > < / div > < div class = "ttdeci" > void push(int8_t opd)< / div > < div class = "ttdoc" > Function to push on the stack.< / div > < div class = "ttdef" > < b > Definition:< / b > postfix_evaluation.c:31< / div > < / div >
< / div > <!-- fragment --> < div class = "dynheader" >
Here is the call graph for this function:< / div >
< div class = "dyncontent" >
2021-12-09 20:57:52 +03:00
< div class = "center" > < iframe scrolling = "no" frameborder = "0" src = "../../df/d43/postfix__evaluation_8c_a4494492c8fc2509f602acc8228a3b623_cgraph.svg" width = "180" height = "88" > < p > < b > This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.< / b > < / p > < / iframe >
2021-10-25 22:34:27 +03:00
< / div >
< / div >
< / div >
< / div >
< a id = "ae66f6b31b5ad750f1fe042a706a4e3d4" name = "ae66f6b31b5ad750f1fe042a706a4e3d4" > < / a >
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#ae66f6b31b5ad750f1fe042a706a4e3d4" > ◆ < / 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 >
< p > initialize< / p >
< p > run self-test implementations< / p >
2022-01-14 23:11:27 +03:00
< div class = "fragment" > < div class = "line" > < span class = "lineno" > 124< / span > {< / div >
< div class = "line" > < span class = "lineno" > 125< / span > < a class = "code hl_variable" href = "../../df/d43/postfix__evaluation_8c.html#a791cc5e78425bce611db4e3bdc4b19d5" > st< / a > .< a class = "code hl_variable" href = "../../dd/d10/struct_stack.html#ad62fb36816185f3eef3a6f735a61f54a" > top< / a > = -1; < span class = "comment" > /// initialize< / span > < / div >
< div class = "line" > < span class = "lineno" > 126< / span > < a class = "code hl_function" href = "../../df/d43/postfix__evaluation_8c.html#aa8dca7b867074164d5f45b0f3851269d" > test< / a > (); < span class = "comment" > /// run self-test implementations< / span > < / div >
< div class = "line" > < span class = "lineno" > 127< / span > < span class = "keywordflow" > return< / span > 0;< / div >
< div class = "line" > < span class = "lineno" > 128< / span > }< / div >
2021-10-25 22:34:27 +03:00
< div class = "ttc" id = "apostfix__evaluation_8c_html_a791cc5e78425bce611db4e3bdc4b19d5" > < div class = "ttname" > < a href = "../../df/d43/postfix__evaluation_8c.html#a791cc5e78425bce611db4e3bdc4b19d5" > st< / a > < / div > < div class = "ttdeci" > struct Stack st< / div > < div class = "ttdoc" > global declaration of stack st< / div > < div class = "ttdef" > < b > Definition:< / b > postfix_evaluation.c:24< / div > < / div >
< div class = "ttc" id = "apostfix__evaluation_8c_html_aa8dca7b867074164d5f45b0f3851269d" > < div class = "ttname" > < a href = "../../df/d43/postfix__evaluation_8c.html#aa8dca7b867074164d5f45b0f3851269d" > test< / a > < / div > < div class = "ttdeci" > static void test()< / div > < div class = "ttdoc" > Self-test implementations.< / div > < div class = "ttdef" > < b > Definition:< / b > postfix_evaluation.c:105< / div > < / div >
< div class = "ttc" id = "astruct_stack_html_ad62fb36816185f3eef3a6f735a61f54a" > < div class = "ttname" > < a href = "../../dd/d10/struct_stack.html#ad62fb36816185f3eef3a6f735a61f54a" > Stack::top< / a > < / div > < div class = "ttdeci" > int top< / div > < div class = "ttdoc" > stores index of the top element< / div > < div class = "ttdef" > < b > Definition:< / b > infix_to_postfix2.c:23< / div > < / div >
< / div > <!-- fragment --> < div class = "dynheader" >
Here is the call graph for this function:< / div >
< div class = "dyncontent" >
2021-12-09 20:57:52 +03:00
< div class = "center" > < iframe scrolling = "no" frameborder = "0" src = "../../df/d43/postfix__evaluation_8c_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg" width = "371" height = "88" > < p > < b > This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.< / b > < / p > < / iframe >
2021-10-25 22:34:27 +03:00
< / div >
< / div >
< / div >
< / div >
< a id = "a8546e4b3f61be1f09ce47f428116ad7d" name = "a8546e4b3f61be1f09ce47f428116ad7d" > < / a >
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#a8546e4b3f61be1f09ce47f428116ad7d" > ◆ < / a > < / span > pop()< / h2 >
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > int8_t pop < / td >
< td > (< / td >
< td class = "paramtype" > void  < / td >
< td class = "paramname" > < / td > < td > )< / td >
< td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > Function to pop from the stack. < / p >
< dl class = "section return" > < dt > Returns< / dt > < dd > popped number < / dd > < / dl >
< p > < to store the popped value to be returned< / p >
2022-01-14 23:11:27 +03:00
< div class = "fragment" > < div class = "line" > < span class = "lineno" > 44< / span > {< / div >
< div class = "line" > < span class = "lineno" > 45< / span > int8_t item; < span class = "comment" > ///< to store the popped value to be returned< / span > < / div >
< div class = "line" > < span class = "lineno" > 46< / span > < span class = "keywordflow" > if< / span > (< a class = "code hl_variable" href = "../../df/d43/postfix__evaluation_8c.html#a791cc5e78425bce611db4e3bdc4b19d5" > st< / a > .< a class = "code hl_variable" href = "../../dd/d10/struct_stack.html#ad62fb36816185f3eef3a6f735a61f54a" > top< / a > == -1) { < span class = "comment" > // underflow condition< / span > < / div >
< div class = "line" > < span class = "lineno" > 47< / span > printf(< span class = "stringliteral" > " Stack underflow..." < / span > );< / div >
< div class = "line" > < span class = "lineno" > 48< / span > exit(1);< / div >
< div class = "line" > < span class = "lineno" > 49< / span > }< / div >
< div class = "line" > < span class = "lineno" > 50< / span > item = < a class = "code hl_variable" href = "../../df/d43/postfix__evaluation_8c.html#a791cc5e78425bce611db4e3bdc4b19d5" > st< / a > .< a class = "code hl_variable" href = "../../dd/d10/struct_stack.html#a856ca6f4a9ffde43f0cb3b43cb4d044d" > stack< / a > [< a class = "code hl_variable" href = "../../df/d43/postfix__evaluation_8c.html#a791cc5e78425bce611db4e3bdc4b19d5" > st< / a > .< a class = "code hl_variable" href = "../../dd/d10/struct_stack.html#ad62fb36816185f3eef3a6f735a61f54a" > top< / a > ];< / div >
< div class = "line" > < span class = "lineno" > 51< / span > < a class = "code hl_variable" href = "../../df/d43/postfix__evaluation_8c.html#a791cc5e78425bce611db4e3bdc4b19d5" > st< / a > .< a class = "code hl_variable" href = "../../dd/d10/struct_stack.html#ad62fb36816185f3eef3a6f735a61f54a" > top< / a > --;< / div >
< div class = "line" > < span class = "lineno" > 52< / span > < span class = "keywordflow" > return< / span > item;< / div >
< div class = "line" > < span class = "lineno" > 53< / span > }< / div >
2021-10-25 22:34:27 +03:00
< div class = "ttc" id = "astruct_stack_html_a856ca6f4a9ffde43f0cb3b43cb4d044d" > < div class = "ttname" > < a href = "../../dd/d10/struct_stack.html#a856ca6f4a9ffde43f0cb3b43cb4d044d" > Stack::stack< / a > < / div > < div class = "ttdeci" > char stack[10]< / div > < div class = "ttdoc" > array stack< / div > < div class = "ttdef" > < b > Definition:< / b > infix_to_postfix2.c:22< / div > < / div >
< / div > <!-- fragment -->
< / div >
< / div >
< a id = "af395c540f7e70a8d82d055a0aa42bbef" name = "af395c540f7e70a8d82d055a0aa42bbef" > < / a >
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#af395c540f7e70a8d82d055a0aa42bbef" > ◆ < / a > < / span > push()< / h2 >
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > void push < / td >
< td > (< / td >
< td class = "paramtype" > int8_t  < / td >
< td class = "paramname" > < em > opd< / em > < / td > < td > )< / td >
< td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > Function to push on the stack. < / p >
< dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > opd< / td > < td > number to be pushed in the stack < / td > < / tr >
< / table >
< / dd >
< / dl >
< dl class = "section return" > < dt > Returns< / dt > < dd > void < / dd > < / dl >
2022-01-14 23:11:27 +03:00
< div class = "fragment" > < div class = "line" > < span class = "lineno" > 31< / span > {< / div >
< div class = "line" > < span class = "lineno" > 32< / span > < span class = "keywordflow" > if< / span > (< a class = "code hl_variable" href = "../../df/d43/postfix__evaluation_8c.html#a791cc5e78425bce611db4e3bdc4b19d5" > st< / a > .< a class = "code hl_variable" href = "../../dd/d10/struct_stack.html#ad62fb36816185f3eef3a6f735a61f54a" > top< / a > == 19) { < span class = "comment" > // overflow condition< / span > < / div >
< div class = "line" > < span class = "lineno" > 33< / span > printf(< span class = "stringliteral" > " Stack overflow..." < / span > );< / div >
< div class = "line" > < span class = "lineno" > 34< / span > exit(1);< / div >
< div class = "line" > < span class = "lineno" > 35< / span > }< / div >
< div class = "line" > < span class = "lineno" > 36< / span > < a class = "code hl_variable" href = "../../df/d43/postfix__evaluation_8c.html#a791cc5e78425bce611db4e3bdc4b19d5" > st< / a > .< a class = "code hl_variable" href = "../../dd/d10/struct_stack.html#ad62fb36816185f3eef3a6f735a61f54a" > top< / a > ++;< / div >
< div class = "line" > < span class = "lineno" > 37< / span > < a class = "code hl_variable" href = "../../df/d43/postfix__evaluation_8c.html#a791cc5e78425bce611db4e3bdc4b19d5" > st< / a > .< a class = "code hl_variable" href = "../../dd/d10/struct_stack.html#a856ca6f4a9ffde43f0cb3b43cb4d044d" > stack< / a > [< a class = "code hl_variable" href = "../../df/d43/postfix__evaluation_8c.html#a791cc5e78425bce611db4e3bdc4b19d5" > st< / a > .< a class = "code hl_variable" href = "../../dd/d10/struct_stack.html#ad62fb36816185f3eef3a6f735a61f54a" > top< / a > ] = opd;< / div >
< div class = "line" > < span class = "lineno" > 38< / span > }< / div >
2021-10-25 22:34:27 +03:00
< / div > <!-- fragment -->
< / div >
< / div >
< a id = "aa8dca7b867074164d5f45b0f3851269d" name = "aa8dca7b867074164d5f45b0f3851269d" > < / a >
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#aa8dca7b867074164d5f45b0f3851269d" > ◆ < / a > < / span > test()< / h2 >
< div class = "memitem" >
< div class = "memproto" >
< table class = "mlabels" >
< tr >
< td class = "mlabels-left" >
< table class = "memname" >
< tr >
< td class = "memname" > static void test < / td >
< td > (< / td >
< td class = "paramtype" > void  < / td >
< td class = "paramname" > < / 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 > Self-test implementations. < / p >
< dl class = "section return" > < dt > Returns< / dt > < dd > void < / dd > < / dl >
< p > this ensures that the algorithm works as expected< / p >
< p > this ensures that the algorithm works as expected< / p >
2022-01-14 23:11:27 +03:00
< div class = "fragment" > < div class = "line" > < span class = "lineno" > 105< / span > {< / div >
< div class = "line" > < span class = "lineno" > 106< / span > < span class = "comment" > /* check sample test case< / span > < / div >
< div class = "line" > < span class = "lineno" > 107< / span > < span class = "comment" > input: " 2 10 + 9 6 - /" < / span > < / div >
< div class = "line" > < span class = "lineno" > 108< / span > < span class = "comment" > expected output: 4< / span > < / div >
< div class = "line" > < span class = "lineno" > 109< / span > < span class = "comment" > */< / span > < / div >
< div class = "line" > < span class = "lineno" > 110< / span > < span class = "keywordtype" > char< / span > temp1[50] = < span class = "stringliteral" > " 2 10 + 9 6 - /" < / span > ;< / div >
< div class = "line" > < span class = "lineno" > 111< / span > assert(< a class = "code hl_function" href = "../../df/d43/postfix__evaluation_8c.html#a4494492c8fc2509f602acc8228a3b623" > evaluate< / a > (temp1) == 4); < span class = "comment" > /// this ensures that the algorithm works as expected< / span > < / div >
< div class = "line" > < span class = "lineno" > 112< / span > < span class = "comment" > /* input: " 4 2 + 3 5 1 - * +" < / span > < / div >
< div class = "line" > < span class = "lineno" > 113< / span > < span class = "comment" > expected output: 18< / span > < / div >
< div class = "line" > < span class = "lineno" > 114< / span > < span class = "comment" > */< / span > < / div >
< div class = "line" > < span class = "lineno" > 115< / span > < span class = "keywordtype" > char< / span > temp2[50] = < span class = "stringliteral" > " 4 2 + 3 5 1 - * +" < / span > ;< / div >
< div class = "line" > < span class = "lineno" > 116< / span > assert(< a class = "code hl_function" href = "../../df/d43/postfix__evaluation_8c.html#a4494492c8fc2509f602acc8228a3b623" > evaluate< / a > (temp2) == 18); < span class = "comment" > /// this ensures that the algorithm works as expected< / span > < / div >
< div class = "line" > < span class = "lineno" > 117< / span > printf(< span class = "stringliteral" > " All tests have successfully passed!\n" < / span > );< / div >
< div class = "line" > < span class = "lineno" > 118< / span > }< / div >
2021-10-25 22:34:27 +03:00
< div class = "ttc" id = "apostfix__evaluation_8c_html_a4494492c8fc2509f602acc8228a3b623" > < div class = "ttname" > < a href = "../../df/d43/postfix__evaluation_8c.html#a4494492c8fc2509f602acc8228a3b623" > evaluate< / a > < / div > < div class = "ttdeci" > int8_t evaluate(char post[])< / div > < div class = "ttdoc" > Function to evaluate postfix expression.< / div > < div class = "ttdef" > < b > Definition:< / b > postfix_evaluation.c:60< / div > < / div >
< / div > <!-- fragment --> < div class = "dynheader" >
Here is the call graph for this function:< / div >
< div class = "dyncontent" >
2021-12-09 20:57:52 +03:00
< div class = "center" > < iframe scrolling = "no" frameborder = "0" src = "../../df/d43/postfix__evaluation_8c_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg" width = "272" height = "88" > < p > < b > This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.< / b > < / p > < / iframe >
2021-10-25 22:34:27 +03: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 = "../../df/d43/postfix__evaluation_8c.html" > postfix_evaluation.c< / a > < / li >
2022-01-14 23:11:27 +03: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 >
2021-10-25 22:34:27 +03:00
< / ul >
< / div >
< / body >
< / html >