2021-02-11 13:15:05 +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" / >
< meta name = "generator" content = "Doxygen 1.9.2" / >
2021-02-11 13:15:05 +08:00
< meta name = "viewport" content = "width=device-width, initial-scale=1" / >
< title > Algorithms_in_C: conversions/infix_to_postfix.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"],
2021-02-11 13:15:05 +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 >
< tr style = "height: 56px;" >
< td id = "projectalign" style = "padding-left: 0.5em;" >
2021-10-26 03:34:27 +08:00
< div id = "projectname" > Algorithms_in_C< span id = "projectnumber" >   1.0.0< / span >
2021-02-11 13:15:05 +08:00
< / div >
< div id = "projectbrief" > Set of algorithms implemented in C.< / div >
< / td >
< / tr >
< / tbody >
< / table >
< / div >
<!-- end header part -->
2021-10-26 03:34:27 +08:00
<!-- Generated by Doxygen 1.9.2 -->
2021-02-11 13:15:05 +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');
2021-02-11 13:15:05 +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 */
2021-02-11 13:15:05 +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 >
2021-02-11 13:15:05 +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 */
2021-02-11 13:15:05 +08:00
$(document).ready(function(){initNavTree('db/d0c/infix__to__postfix_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" > infix_to_postfix.c File Reference< / div > < / div >
2021-02-11 13:15:05 +08:00
< / div > <!-- header -->
< div class = "contents" >
2021-10-26 03:34:27 +08:00
< p > < a href = "https://condor.depaul.edu/ichu/csc415/notes/notes9/Infix.htm" target = "_blank" > Infix to Postfix< / a > Expression Conversion
2021-02-11 13:15:05 +08:00
< a href = "#details" > More...< / a > < / p >
< div class = "textblock" > < code > #include < stdio.h> < / code > < br / >
< / div > < div class = "textblock" > < div class = "dynheader" >
Include dependency graph for infix_to_postfix.c:< / div >
< div class = "dyncontent" >
< div class = "center" > < iframe scrolling = "no" frameborder = "0" src = "../../dc/dc9/infix__to__postfix_8c__incl.svg" width = "150" height = "127" > < 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 >
2021-02-11 13:15:05 +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 = "../../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" >
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 >
2021-02-11 13:15:05 +08:00
Functions< / h2 > < / td > < / tr >
< tr class = "memitem:a613462735d30cae1b85b606ecab30554" > < td class = "memItemLeft" align = "right" valign = "top" > void  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../db/d0c/infix__to__postfix_8c.html#a613462735d30cae1b85b606ecab30554" > push< / a > (struct < a class = "el" href = "../../dd/d10/struct_stack.html" > Stack< / a > *p, char x)< / td > < / tr >
< tr class = "memdesc:a613462735d30cae1b85b606ecab30554" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > push function < a href = "../../db/d0c/infix__to__postfix_8c.html#a613462735d30cae1b85b606ecab30554" > More...< / a > < br / > < / td > < / tr >
< tr class = "separator:a613462735d30cae1b85b606ecab30554" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:a940cdcd27c40699eebb4ef113b2d9451" > < td class = "memItemLeft" align = "right" valign = "top" > char  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../db/d0c/infix__to__postfix_8c.html#a940cdcd27c40699eebb4ef113b2d9451" > pop< / a > (struct < a class = "el" href = "../../dd/d10/struct_stack.html" > Stack< / a > *p)< / td > < / tr >
< tr class = "memdesc:a940cdcd27c40699eebb4ef113b2d9451" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > pop function < a href = "../../db/d0c/infix__to__postfix_8c.html#a940cdcd27c40699eebb4ef113b2d9451" > More...< / a > < br / > < / td > < / tr >
< tr class = "separator:a940cdcd27c40699eebb4ef113b2d9451" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:afd8245c04b202240390de23170f72d6b" > < td class = "memItemLeft" align = "right" valign = "top" > int  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../db/d0c/infix__to__postfix_8c.html#afd8245c04b202240390de23170f72d6b" > isOprnd< / a > (char ch)< / td > < / tr >
< tr class = "memdesc:afd8245c04b202240390de23170f72d6b" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > isOprnd function < a href = "../../db/d0c/infix__to__postfix_8c.html#afd8245c04b202240390de23170f72d6b" > More...< / a > < br / > < / td > < / tr >
< tr class = "separator:afd8245c04b202240390de23170f72d6b" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:afa8471c76bc57b12ad21de22beb39021" > < td class = "memItemLeft" align = "right" valign = "top" > int  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../db/d0c/infix__to__postfix_8c.html#afa8471c76bc57b12ad21de22beb39021" > isEmpty< / a > (struct < a class = "el" href = "../../dd/d10/struct_stack.html" > Stack< / a > s)< / td > < / tr >
< tr class = "memdesc:afa8471c76bc57b12ad21de22beb39021" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > isEmpty function < a href = "../../db/d0c/infix__to__postfix_8c.html#afa8471c76bc57b12ad21de22beb39021" > More...< / a > < br / > < / td > < / tr >
< tr class = "separator:afa8471c76bc57b12ad21de22beb39021" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:ac91f38ad7885fca93e39325361a5c787" > < td class = "memItemLeft" align = "right" valign = "top" > int  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../db/d0c/infix__to__postfix_8c.html#ac91f38ad7885fca93e39325361a5c787" > getPrecedence< / a > (char op1, char op2)< / td > < / tr >
< tr class = "memdesc:ac91f38ad7885fca93e39325361a5c787" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > getPrecedence function returns the precedence after comparing two operators passed as parameter. < a href = "../../db/d0c/infix__to__postfix_8c.html#ac91f38ad7885fca93e39325361a5c787" > More...< / a > < br / > < / td > < / tr >
< tr class = "separator:ac91f38ad7885fca93e39325361a5c787" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:a92af69ffc1e1f965ebce6a44672e96b1" > < td class = "memItemLeft" align = "right" valign = "top" > void  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../db/d0c/infix__to__postfix_8c.html#a92af69ffc1e1f965ebce6a44672e96b1" > convert< / a > (char infix[], char postfix[])< / td > < / tr >
< tr class = "memdesc:a92af69ffc1e1f965ebce6a44672e96b1" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > convert function < a href = "../../db/d0c/infix__to__postfix_8c.html#a92af69ffc1e1f965ebce6a44672e96b1" > More...< / a > < br / > < / td > < / tr >
< tr class = "separator:a92af69ffc1e1f965ebce6a44672e96b1" > < 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 = "../../db/d0c/infix__to__postfix_8c.html#ae66f6b31b5ad750f1fe042a706a4e3d4" > main< / a > ()< / td > < / tr >
< tr class = "memdesc:ae66f6b31b5ad750f1fe042a706a4e3d4" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > main function < a href = "../../db/d0c/infix__to__postfix_8c.html#ae66f6b31b5ad750f1fe042a706a4e3d4" > More...< / a > < br / > < / td > < / tr >
< tr class = "separator:ae66f6b31b5ad750f1fe042a706a4e3d4" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< / table >
< a name = "details" id = "details" > < / a > < h2 class = "groupheader" > Detailed Description< / h2 >
2021-10-26 03:34:27 +08:00
< div class = "textblock" > < p > < a href = "https://condor.depaul.edu/ichu/csc415/notes/notes9/Infix.htm" target = "_blank" > Infix to Postfix< / a > Expression Conversion < / p >
< p > Convert Infixed expressions to Postfix expression. < / p > < dl class = "section author" > < dt > Author< / dt > < dd > < a href = "https://github.com/harshcut" target = "_blank" > Harsh Karande< / a > < / dd > < / dl >
2021-02-11 13:15:05 +08:00
< / div > < h2 class = "groupheader" > Function Documentation< / h2 >
2021-10-26 03:34:27 +08:00
< a id = "a92af69ffc1e1f965ebce6a44672e96b1" name = "a92af69ffc1e1f965ebce6a44672e96b1" > < / a >
2021-02-11 13:15:05 +08:00
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#a92af69ffc1e1f965ebce6a44672e96b1" > ◆ < / a > < / span > convert()< / h2 >
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > void convert < / td >
< td > (< / td >
< td class = "paramtype" > char  < / td >
< td class = "paramname" > < em > infix< / em > [], < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > char  < / td >
< td class = "paramname" > < em > postfix< / em > []  < / td >
< / tr >
< tr >
< td > < / td >
< td > )< / td >
< td > < / td > < td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > convert function < / p >
< dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > infix[]< / td > < td > : infix array provided by user < / td > < / tr >
< tr > < td class = "paramname" > postfix[]< / td > < td > : empty array to be given to < a class = "el" href = "../../db/d0c/infix__to__postfix_8c.html#a92af69ffc1e1f965ebce6a44672e96b1" title = "convert function" > convert()< / a > < / td > < / tr >
< / table >
< / dd >
< / dl >
< dl class = "section return" > < dt > Returns< / dt > < dd > postfixed expresion or \0 on exit < / dd > < / dl >
2021-10-26 03:34:27 +08:00
< div class = "fragment" > < div class = "line" > < a id = "l00131" name = "l00131" > < / a > < span class = "lineno" > 131< / span > {< / div >
< div class = "line" > < a id = "l00132" name = "l00132" > < / a > < span class = "lineno" > 132< / span > < span class = "keyword" > struct < / span > < a class = "code hl_struct" href = "../../dd/d10/struct_stack.html" > Stack< / a > s; < span class = "comment" > // initialze object reference of stack< / span > < / div >
< div class = "line" > < a id = "l00133" name = "l00133" > < / a > < span class = "lineno" > 133< / span > s.< a class = "code hl_variable" href = "../../dd/d10/struct_stack.html#ac2dbef151bc913684a90b06836725ef9" > tos< / a > = -1; < span class = "comment" > // initalize the tos< / span > < / div >
< div class = "line" > < a id = "l00134" name = "l00134" > < / a > < span class = "lineno" > 134< / span > < / div >
< div class = "line" > < a id = "l00135" name = "l00135" > < / a > < span class = "lineno" > 135< / span > < span class = "keywordtype" > int< / span > i, j = 0, pr;< / div >
< div class = "line" > < a id = "l00136" name = "l00136" > < / a > < span class = "lineno" > 136< / span > < span class = "keywordtype" > char< / span > ch, temp;< / div >
< div class = "line" > < a id = "l00137" name = "l00137" > < / a > < span class = "lineno" > 137< / span > < / div >
< div class = "line" > < a id = "l00138" name = "l00138" > < / a > < span class = "lineno" > 138< / span > < span class = "keywordflow" > for< / span > (i = 0; infix[i] != < span class = "charliteral" > ' \0' < / span > ; i++)< / div >
< div class = "line" > < a id = "l00139" name = "l00139" > < / a > < span class = "lineno" > 139< / span > {< / div >
< div class = "line" > < a id = "l00140" name = "l00140" > < / a > < span class = "lineno" > 140< / span > ch = infix[i];< / div >
< div class = "line" > < a id = "l00141" name = "l00141" > < / a > < span class = "lineno" > 141< / span > < / div >
< div class = "line" > < a id = "l00142" name = "l00142" > < / a > < span class = "lineno" > 142< / span > < span class = "keywordflow" > if< / span > (< a class = "code hl_function" href = "../../db/d0c/infix__to__postfix_8c.html#afd8245c04b202240390de23170f72d6b" > isOprnd< / a > (ch) == 1) < span class = "comment" > // check if char is operand or operator< / span > < / div >
< div class = "line" > < a id = "l00143" name = "l00143" > < / a > < span class = "lineno" > 143< / span > {< / div >
< div class = "line" > < a id = "l00144" name = "l00144" > < / a > < span class = "lineno" > 144< / span > postfix[j] = ch; < span class = "comment" > // assign ch to postfix array with index j< / span > < / div >
< div class = "line" > < a id = "l00145" name = "l00145" > < / a > < span class = "lineno" > 145< / span > j++; < span class = "comment" > // incement j< / span > < / div >
< div class = "line" > < a id = "l00146" name = "l00146" > < / a > < span class = "lineno" > 146< / span > }< / div >
< div class = "line" > < a id = "l00147" name = "l00147" > < / a > < span class = "lineno" > 147< / span > < span class = "keywordflow" > else< / span > < / div >
< div class = "line" > < a id = "l00148" name = "l00148" > < / a > < span class = "lineno" > 148< / span > {< / div >
< div class = "line" > < a id = "l00149" name = "l00149" > < / a > < span class = "lineno" > 149< / span > < span class = "keywordflow" > if< / span > (ch == < span class = "charliteral" > ' (' < / span > )< / div >
< div class = "line" > < a id = "l00150" name = "l00150" > < / a > < span class = "lineno" > 150< / span > {< / div >
< div class = "line" > < a id = "l00151" name = "l00151" > < / a > < span class = "lineno" > 151< / span > < a class = "code hl_function" href = "../../db/d0c/infix__to__postfix_8c.html#a613462735d30cae1b85b606ecab30554" > push< / a > (& s, ch);< / div >
< div class = "line" > < a id = "l00152" name = "l00152" > < / a > < span class = "lineno" > 152< / span > }< / div >
< div class = "line" > < a id = "l00153" name = "l00153" > < / a > < span class = "lineno" > 153< / span > < span class = "keywordflow" > else< / span > < / div >
< div class = "line" > < a id = "l00154" name = "l00154" > < / a > < span class = "lineno" > 154< / span > {< / div >
< div class = "line" > < a id = "l00155" name = "l00155" > < / a > < span class = "lineno" > 155< / span > < span class = "keywordflow" > if< / span > (ch == < span class = "charliteral" > ' )' < / span > )< / div >
< div class = "line" > < a id = "l00156" name = "l00156" > < / a > < span class = "lineno" > 156< / span > {< / div >
< div class = "line" > < a id = "l00157" name = "l00157" > < / a > < span class = "lineno" > 157< / span > < span class = "keywordflow" > while< / span > ((temp = < a class = "code hl_function" href = "../../db/d0c/infix__to__postfix_8c.html#a940cdcd27c40699eebb4ef113b2d9451" > pop< / a > (& s)) != < span class = "charliteral" > ' (' < / span > )< / div >
< div class = "line" > < a id = "l00158" name = "l00158" > < / a > < span class = "lineno" > 158< / span > {< / div >
< div class = "line" > < a id = "l00159" name = "l00159" > < / a > < span class = "lineno" > 159< / span > postfix[j] = temp;< / div >
< div class = "line" > < a id = "l00160" name = "l00160" > < / a > < span class = "lineno" > 160< / span > j++;< / div >
< div class = "line" > < a id = "l00161" name = "l00161" > < / a > < span class = "lineno" > 161< / span > }< / div >
< div class = "line" > < a id = "l00162" name = "l00162" > < / a > < span class = "lineno" > 162< / span > }< / div >
< div class = "line" > < a id = "l00163" name = "l00163" > < / a > < span class = "lineno" > 163< / span > < span class = "keywordflow" > else< / span > < / div >
< div class = "line" > < a id = "l00164" name = "l00164" > < / a > < span class = "lineno" > 164< / span > {< / div >
< div class = "line" > < a id = "l00165" name = "l00165" > < / a > < span class = "lineno" > 165< / span > < span class = "keywordflow" > while< / span > (< a class = "code hl_function" href = "../../db/d0c/infix__to__postfix_8c.html#afa8471c76bc57b12ad21de22beb39021" > isEmpty< / a > (s) == 0) < span class = "comment" > // check if stack is empty< / span > < / div >
< div class = "line" > < a id = "l00166" name = "l00166" > < / a > < span class = "lineno" > 166< / span > {< / div >
< div class = "line" > < a id = "l00167" name = "l00167" > < / a > < span class = "lineno" > 167< / span > pr = < a class = "code hl_function" href = "../../db/d0c/infix__to__postfix_8c.html#ac91f38ad7885fca93e39325361a5c787" > getPrecedence< / a > (ch,< / div >
< div class = "line" > < a id = "l00168" name = "l00168" > < / a > < span class = "lineno" > 168< / span > s.arr[s.tos]); < span class = "comment" > // check operator precedence< / span > < / div >
< div class = "line" > < a id = "l00169" name = "l00169" > < / a > < span class = "lineno" > 169< / span > < / div >
< div class = "line" > < a id = "l00170" name = "l00170" > < / a > < span class = "lineno" > 170< / span > < span class = "keywordflow" > if< / span > (pr == 1)< / div >
< div class = "line" > < a id = "l00171" name = "l00171" > < / a > < span class = "lineno" > 171< / span > {< / div >
< div class = "line" > < a id = "l00172" name = "l00172" > < / a > < span class = "lineno" > 172< / span > < span class = "keywordflow" > break< / span > ; < span class = "comment" > // if ch has a greater precedence than< / span > < / div >
< div class = "line" > < a id = "l00173" name = "l00173" > < / a > < span class = "lineno" > 173< / span > < span class = "comment" > // s.arr[s.top]< / span > < / div >
< div class = "line" > < a id = "l00174" name = "l00174" > < / a > < span class = "lineno" > 174< / span > }< / div >
< div class = "line" > < a id = "l00175" name = "l00175" > < / a > < span class = "lineno" > 175< / span > < / div >
< div class = "line" > < a id = "l00176" name = "l00176" > < / a > < span class = "lineno" > 176< / span > postfix[j] = < a class = "code hl_function" href = "../../db/d0c/infix__to__postfix_8c.html#a940cdcd27c40699eebb4ef113b2d9451" > pop< / a > (& s);< / div >
< div class = "line" > < a id = "l00177" name = "l00177" > < / a > < span class = "lineno" > 177< / span > j++;< / div >
< div class = "line" > < a id = "l00178" name = "l00178" > < / a > < span class = "lineno" > 178< / span > }< / div >
< div class = "line" > < a id = "l00179" name = "l00179" > < / a > < span class = "lineno" > 179< / span > < / div >
< div class = "line" > < a id = "l00180" name = "l00180" > < / a > < span class = "lineno" > 180< / span > < a class = "code hl_function" href = "../../db/d0c/infix__to__postfix_8c.html#a613462735d30cae1b85b606ecab30554" > push< / a > (& s, ch); < span class = "comment" > // push ch to stack< / span > < / div >
< div class = "line" > < a id = "l00181" name = "l00181" > < / a > < span class = "lineno" > 181< / span > }< / div >
< div class = "line" > < a id = "l00182" name = "l00182" > < / a > < span class = "lineno" > 182< / span > }< / div >
< div class = "line" > < a id = "l00183" name = "l00183" > < / a > < span class = "lineno" > 183< / span > }< / div >
< div class = "line" > < a id = "l00184" name = "l00184" > < / a > < span class = "lineno" > 184< / span > }< / div >
< div class = "line" > < a id = "l00185" name = "l00185" > < / a > < span class = "lineno" > 185< / span > < / div >
< div class = "line" > < a id = "l00186" name = "l00186" > < / a > < span class = "lineno" > 186< / span > < span class = "keywordflow" > while< / span > (< a class = "code hl_function" href = "../../db/d0c/infix__to__postfix_8c.html#afa8471c76bc57b12ad21de22beb39021" > isEmpty< / a > (s) == 0) < span class = "comment" > // check if stack is empty< / span > < / div >
< div class = "line" > < a id = "l00187" name = "l00187" > < / a > < span class = "lineno" > 187< / span > {< / div >
< div class = "line" > < a id = "l00188" name = "l00188" > < / a > < span class = "lineno" > 188< / span > postfix[j] = < a class = "code hl_function" href = "../../db/d0c/infix__to__postfix_8c.html#a940cdcd27c40699eebb4ef113b2d9451" > pop< / a > (& s);< / div >
< div class = "line" > < a id = "l00189" name = "l00189" > < / a > < span class = "lineno" > 189< / span > j++;< / div >
< div class = "line" > < a id = "l00190" name = "l00190" > < / a > < span class = "lineno" > 190< / span > }< / div >
< div class = "line" > < a id = "l00191" name = "l00191" > < / a > < span class = "lineno" > 191< / span > < / div >
< div class = "line" > < a id = "l00192" name = "l00192" > < / a > < span class = "lineno" > 192< / span > postfix[j] = < span class = "charliteral" > ' \0' < / span > ;< / div >
< div class = "line" > < a id = "l00193" name = "l00193" > < / a > < span class = "lineno" > 193< / span > }< / div >
2021-02-11 13:15:05 +08:00
< div class = "ttc" id = "ainfix__to__postfix_8c_html_a613462735d30cae1b85b606ecab30554" > < div class = "ttname" > < a href = "../../db/d0c/infix__to__postfix_8c.html#a613462735d30cae1b85b606ecab30554" > push< / a > < / div > < div class = "ttdeci" > void push(struct Stack *p, char ch)< / div > < div class = "ttdoc" > push function< / div > < div class = "ttdef" > < b > Definition:< / b > infix_to_postfix.c:55< / div > < / div >
< div class = "ttc" id = "ainfix__to__postfix_8c_html_a940cdcd27c40699eebb4ef113b2d9451" > < div class = "ttname" > < a href = "../../db/d0c/infix__to__postfix_8c.html#a940cdcd27c40699eebb4ef113b2d9451" > pop< / a > < / div > < div class = "ttdeci" > char pop(struct Stack *p)< / div > < div class = "ttdoc" > pop function< / div > < div class = "ttdef" > < b > Definition:< / b > infix_to_postfix.c:72< / div > < / div >
< div class = "ttc" id = "ainfix__to__postfix_8c_html_ac91f38ad7885fca93e39325361a5c787" > < div class = "ttname" > < a href = "../../db/d0c/infix__to__postfix_8c.html#ac91f38ad7885fca93e39325361a5c787" > getPrecedence< / a > < / div > < div class = "ttdeci" > int getPrecedence(char op1, char op2)< / div > < div class = "ttdoc" > getPrecedence function returns the precedence after comparing two operators passed as parameter.< / div > < div class = "ttdef" > < b > Definition:< / b > infix_to_postfix.c:201< / div > < / div >
< div class = "ttc" id = "ainfix__to__postfix_8c_html_afa8471c76bc57b12ad21de22beb39021" > < div class = "ttname" > < a href = "../../db/d0c/infix__to__postfix_8c.html#afa8471c76bc57b12ad21de22beb39021" > isEmpty< / a > < / div > < div class = "ttdeci" > int isEmpty(struct Stack s)< / div > < div class = "ttdoc" > isEmpty function< / div > < div class = "ttdef" > < b > Definition:< / b > infix_to_postfix.c:112< / div > < / div >
< div class = "ttc" id = "ainfix__to__postfix_8c_html_afd8245c04b202240390de23170f72d6b" > < div class = "ttname" > < a href = "../../db/d0c/infix__to__postfix_8c.html#afd8245c04b202240390de23170f72d6b" > isOprnd< / a > < / div > < div class = "ttdeci" > int isOprnd(char ch)< / div > < div class = "ttdoc" > isOprnd function< / div > < div class = "ttdef" > < b > Definition:< / b > infix_to_postfix.c:93< / div > < / div >
< div class = "ttc" id = "astruct_stack_html" > < div class = "ttname" > < a href = "../../dd/d10/struct_stack.html" > Stack< / a > < / div > < div class = "ttdoc" > for printf() and scanf()< / div > < div class = "ttdef" > < b > Definition:< / b > infix_to_postfix.c:18< / div > < / div >
< div class = "ttc" id = "astruct_stack_html_ac2dbef151bc913684a90b06836725ef9" > < div class = "ttname" > < a href = "../../dd/d10/struct_stack.html#ac2dbef151bc913684a90b06836725ef9" > Stack::tos< / a > < / div > < div class = "ttdeci" > int tos< / div > < div class = "ttdoc" > static array of integers< / div > < div class = "ttdef" > < b > Definition:< / b > infix_to_postfix.c:20< / div > < / div >
< / 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 = "../../db/d0c/infix__to__postfix_8c_a92af69ffc1e1f965ebce6a44672e96b1_cgraph.svg" width = "234" height = "240" > < p > < b > This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.< / b > < / p > < / iframe >
2021-02-11 13:15:05 +08:00
< / div >
< / div >
< / div >
< / div >
2021-10-26 03:34:27 +08:00
< a id = "ac91f38ad7885fca93e39325361a5c787" name = "ac91f38ad7885fca93e39325361a5c787" > < / a >
2021-02-11 13:15:05 +08:00
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#ac91f38ad7885fca93e39325361a5c787" > ◆ < / a > < / span > getPrecedence()< / h2 >
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > int getPrecedence < / td >
< td > (< / td >
< td class = "paramtype" > char  < / td >
< td class = "paramname" > < em > op1< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > char  < / td >
< td class = "paramname" > < em > op2< / em >   < / td >
< / tr >
< tr >
< td > < / td >
< td > )< / td >
< td > < / td > < td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > getPrecedence function returns the precedence after comparing two operators passed as parameter. < / p >
< dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > op1< / td > < td > : first operator < / td > < / tr >
< tr > < td class = "paramname" > op2< / td > < td > : second operator < / td > < / tr >
< / table >
< / dd >
< / dl >
< dl class = "section return" > < dt > Returns< / dt > < dd > 1 or 0 on exit < / dd > < / dl >
2021-10-26 03:34:27 +08:00
< div class = "fragment" > < div class = "line" > < a id = "l00202" name = "l00202" > < / a > < span class = "lineno" > 202< / span > {< / div >
< div class = "line" > < a id = "l00203" name = "l00203" > < / a > < span class = "lineno" > 203< / span > < span class = "keywordflow" > if< / span > (op2 == < span class = "charliteral" > ' $' < / span > )< / div >
< div class = "line" > < a id = "l00204" name = "l00204" > < / a > < span class = "lineno" > 204< / span > {< / div >
< div class = "line" > < a id = "l00205" name = "l00205" > < / a > < span class = "lineno" > 205< / span > < span class = "keywordflow" > return< / span > 0;< / div >
< div class = "line" > < a id = "l00206" name = "l00206" > < / a > < span class = "lineno" > 206< / span > }< / div >
< div class = "line" > < a id = "l00207" name = "l00207" > < / a > < span class = "lineno" > 207< / span > < span class = "keywordflow" > else< / span > < span class = "keywordflow" > if< / span > (op1 == < span class = "charliteral" > ' $' < / span > )< / div >
< div class = "line" > < a id = "l00208" name = "l00208" > < / a > < span class = "lineno" > 208< / span > {< / div >
< div class = "line" > < a id = "l00209" name = "l00209" > < / a > < span class = "lineno" > 209< / span > < span class = "keywordflow" > return< / span > 1;< / div >
< div class = "line" > < a id = "l00210" name = "l00210" > < / a > < span class = "lineno" > 210< / span > }< / div >
< div class = "line" > < a id = "l00211" name = "l00211" > < / a > < span class = "lineno" > 211< / span > < span class = "keywordflow" > else< / span > < span class = "keywordflow" > if< / span > (op2 == < span class = "charliteral" > ' *' < / span > || op2 == < span class = "charliteral" > ' /' < / span > || op2 == < span class = "charliteral" > ' %' < / span > )< / div >
< div class = "line" > < a id = "l00212" name = "l00212" > < / a > < span class = "lineno" > 212< / span > {< / div >
< div class = "line" > < a id = "l00213" name = "l00213" > < / a > < span class = "lineno" > 213< / span > < span class = "keywordflow" > return< / span > 0;< / div >
< div class = "line" > < a id = "l00214" name = "l00214" > < / a > < span class = "lineno" > 214< / span > }< / div >
< div class = "line" > < a id = "l00215" name = "l00215" > < / a > < span class = "lineno" > 215< / span > < span class = "keywordflow" > else< / span > < span class = "keywordflow" > if< / span > (op1 == < span class = "charliteral" > ' *' < / span > || op1 == < span class = "charliteral" > ' /' < / span > || op1 == < span class = "charliteral" > ' %' < / span > )< / div >
< div class = "line" > < a id = "l00216" name = "l00216" > < / a > < span class = "lineno" > 216< / span > {< / div >
< div class = "line" > < a id = "l00217" name = "l00217" > < / a > < span class = "lineno" > 217< / span > < span class = "keywordflow" > return< / span > 1;< / div >
< div class = "line" > < a id = "l00218" name = "l00218" > < / a > < span class = "lineno" > 218< / span > }< / div >
< div class = "line" > < a id = "l00219" name = "l00219" > < / a > < span class = "lineno" > 219< / span > < span class = "keywordflow" > else< / span > < span class = "keywordflow" > if< / span > (op2 == < span class = "charliteral" > ' +' < / span > || op2 == < span class = "charliteral" > ' -' < / span > )< / div >
< div class = "line" > < a id = "l00220" name = "l00220" > < / a > < span class = "lineno" > 220< / span > {< / div >
< div class = "line" > < a id = "l00221" name = "l00221" > < / a > < span class = "lineno" > 221< / span > < span class = "keywordflow" > return< / span > 0;< / div >
< div class = "line" > < a id = "l00222" name = "l00222" > < / a > < span class = "lineno" > 222< / span > }< / div >
< div class = "line" > < a id = "l00223" name = "l00223" > < / a > < span class = "lineno" > 223< / span > < span class = "keywordflow" > else< / span > < / div >
< div class = "line" > < a id = "l00224" name = "l00224" > < / a > < span class = "lineno" > 224< / span > {< / div >
< div class = "line" > < a id = "l00225" name = "l00225" > < / a > < span class = "lineno" > 225< / span > < span class = "keywordflow" > return< / span > 1;< / div >
< div class = "line" > < a id = "l00226" name = "l00226" > < / a > < span class = "lineno" > 226< / span > }< / div >
< div class = "line" > < a id = "l00227" name = "l00227" > < / a > < span class = "lineno" > 227< / span > }< / div >
2021-02-11 13:15:05 +08:00
< / div > <!-- fragment -->
< / div >
< / div >
2021-10-26 03:34:27 +08:00
< a id = "afa8471c76bc57b12ad21de22beb39021" name = "afa8471c76bc57b12ad21de22beb39021" > < / a >
2021-02-11 13:15:05 +08:00
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#afa8471c76bc57b12ad21de22beb39021" > ◆ < / a > < / span > isEmpty()< / h2 >
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > int isEmpty < / td >
< td > (< / td >
< td class = "paramtype" > struct < a class = "el" href = "../../dd/d10/struct_stack.html" > Stack< / a >   < / td >
< td class = "paramname" > < em > s< / em > < / td > < td > )< / td >
< td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > isEmpty function < / p >
< dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > s< / td > < td > : it is the object reference of stack < / td > < / tr >
< / table >
< / dd >
< / dl >
< dl class = "section return" > < dt > Returns< / dt > < dd > 1 or 0 on exit < / dd > < / dl >
2021-10-26 03:34:27 +08:00
< div class = "fragment" > < div class = "line" > < a id = "l00113" name = "l00113" > < / a > < span class = "lineno" > 113< / span > {< / div >
< div class = "line" > < a id = "l00114" name = "l00114" > < / a > < span class = "lineno" > 114< / span > < span class = "keywordflow" > if< / span > (s.< a class = "code hl_variable" href = "../../dd/d10/struct_stack.html#ac2dbef151bc913684a90b06836725ef9" > tos< / a > == -1) < span class = "comment" > // check if stack is empty< / span > < / div >
< div class = "line" > < a id = "l00115" name = "l00115" > < / a > < span class = "lineno" > 115< / span > {< / div >
< div class = "line" > < a id = "l00116" name = "l00116" > < / a > < span class = "lineno" > 116< / span > < span class = "keywordflow" > return< / span > 1; < span class = "comment" > // return for true result< / span > < / div >
< div class = "line" > < a id = "l00117" name = "l00117" > < / a > < span class = "lineno" > 117< / span > }< / div >
< div class = "line" > < a id = "l00118" name = "l00118" > < / a > < span class = "lineno" > 118< / span > < span class = "keywordflow" > else< / span > < / div >
< div class = "line" > < a id = "l00119" name = "l00119" > < / a > < span class = "lineno" > 119< / span > {< / div >
< div class = "line" > < a id = "l00120" name = "l00120" > < / a > < span class = "lineno" > 120< / span > < span class = "keywordflow" > return< / span > 0; < span class = "comment" > // return for false result< / span > < / div >
< div class = "line" > < a id = "l00121" name = "l00121" > < / a > < span class = "lineno" > 121< / span > }< / div >
< div class = "line" > < a id = "l00122" name = "l00122" > < / a > < span class = "lineno" > 122< / span > }< / div >
2021-02-11 13:15:05 +08:00
< / div > <!-- fragment -->
< / div >
< / div >
2021-10-26 03:34:27 +08:00
< a id = "afd8245c04b202240390de23170f72d6b" name = "afd8245c04b202240390de23170f72d6b" > < / a >
2021-02-11 13:15:05 +08:00
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#afd8245c04b202240390de23170f72d6b" > ◆ < / a > < / span > isOprnd()< / h2 >
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > int isOprnd < / td >
< td > (< / td >
< td class = "paramtype" > char  < / td >
< td class = "paramname" > < em > ch< / em > < / td > < td > )< / td >
< td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > isOprnd function < / p >
< dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > ch< / td > < td > : this is the element from the infix array < / td > < / tr >
< / table >
< / dd >
< / dl >
< dl class = "section return" > < dt > Returns< / dt > < dd > 1 or 0 on exit < / dd > < / dl >
2021-10-26 03:34:27 +08:00
< div class = "fragment" > < div class = "line" > < a id = "l00094" name = "l00094" > < / a > < span class = "lineno" > 94< / span > {< / div >
< div class = "line" > < a id = "l00095" name = "l00095" > < / a > < span class = "lineno" > 95< / span > < span class = "keywordflow" > if< / span > ((ch > = 65 & & ch < = 90) ||< / div >
< div class = "line" > < a id = "l00096" name = "l00096" > < / a > < span class = "lineno" > 96< / span > (ch > = 97 & & ch < = 122) || < span class = "comment" > // check if ch is an operator or< / span > < / div >
< div class = "line" > < a id = "l00097" name = "l00097" > < / a > < span class = "lineno" > 97< / span > (ch > = 48 & & ch < = 57)) < span class = "comment" > // operand using ASCII values< / span > < / div >
< div class = "line" > < a id = "l00098" name = "l00098" > < / a > < span class = "lineno" > 98< / span > {< / div >
< div class = "line" > < a id = "l00099" name = "l00099" > < / a > < span class = "lineno" > 99< / span > < span class = "keywordflow" > return< / span > 1; < span class = "comment" > // return for true result< / span > < / div >
< div class = "line" > < a id = "l00100" name = "l00100" > < / a > < span class = "lineno" > 100< / span > }< / div >
< div class = "line" > < a id = "l00101" name = "l00101" > < / a > < span class = "lineno" > 101< / span > < span class = "keywordflow" > else< / span > < / div >
< div class = "line" > < a id = "l00102" name = "l00102" > < / a > < span class = "lineno" > 102< / span > {< / div >
< div class = "line" > < a id = "l00103" name = "l00103" > < / a > < span class = "lineno" > 103< / span > < span class = "keywordflow" > return< / span > 0; < span class = "comment" > // return for false result< / span > < / div >
< div class = "line" > < a id = "l00104" name = "l00104" > < / a > < span class = "lineno" > 104< / span > }< / div >
< div class = "line" > < a id = "l00105" name = "l00105" > < / a > < span class = "lineno" > 105< / span > }< / div >
2021-02-11 13:15:05 +08:00
< / div > <!-- fragment -->
< / div >
< / div >
2021-10-26 03:34:27 +08:00
< a id = "ae66f6b31b5ad750f1fe042a706a4e3d4" name = "ae66f6b31b5ad750f1fe042a706a4e3d4" > < / a >
2021-02-11 13:15:05 +08:00
< 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 >
2021-10-26 03:34:27 +08:00
< div class = "fragment" > < div class = "line" > < a id = "l00037" name = "l00037" > < / a > < span class = "lineno" > 37< / span > {< / div >
< div class = "line" > < a id = "l00038" name = "l00038" > < / a > < span class = "lineno" > 38< / span > < span class = "keywordtype" > char< / span > infix[20], postfix[20]; < span class = "comment" > // initialize empty infix and postfix array< / span > < / div >
< div class = "line" > < a id = "l00039" name = "l00039" > < / a > < span class = "lineno" > 39< / span > < / div >
< div class = "line" > < a id = "l00040" name = "l00040" > < / a > < span class = "lineno" > 40< / span > printf(< span class = "stringliteral" > " Enter infix expression: " < / span > ); < span class = "comment" > // example : A+B-C*D/E$F< / span > < / div >
< div class = "line" > < a id = "l00041" name = "l00041" > < / a > < span class = "lineno" > 41< / span > scanf(< span class = "stringliteral" > " %s" < / span > , infix); < span class = "comment" > // get values for infix array< / span > < / div >
< div class = "line" > < a id = "l00042" name = "l00042" > < / a > < span class = "lineno" > 42< / span > < / div >
< div class = "line" > < a id = "l00043" name = "l00043" > < / a > < span class = "lineno" > 43< / span > < a class = "code hl_function" href = "../../db/d0c/infix__to__postfix_8c.html#a92af69ffc1e1f965ebce6a44672e96b1" > convert< / a > (infix, postfix);< / div >
< div class = "line" > < a id = "l00044" name = "l00044" > < / a > < span class = "lineno" > 44< / span > printf(< span class = "stringliteral" > " Postfix expression is %s" < / span > , postfix); < span class = "comment" > // output : AB+CD*EF$/-< / span > < / div >
< div class = "line" > < a id = "l00045" name = "l00045" > < / a > < span class = "lineno" > 45< / span > < / div >
< div class = "line" > < a id = "l00046" name = "l00046" > < / a > < span class = "lineno" > 46< / span > < span class = "keywordflow" > return< / span > 0;< / div >
< div class = "line" > < a id = "l00047" name = "l00047" > < / a > < span class = "lineno" > 47< / span > }< / div >
2021-02-11 13:15:05 +08:00
< div class = "ttc" id = "ainfix__to__postfix_8c_html_a92af69ffc1e1f965ebce6a44672e96b1" > < div class = "ttname" > < a href = "../../db/d0c/infix__to__postfix_8c.html#a92af69ffc1e1f965ebce6a44672e96b1" > convert< / a > < / div > < div class = "ttdeci" > void convert(char infix[], char postfix[])< / div > < div class = "ttdoc" > convert function< / div > < div class = "ttdef" > < b > Definition:< / b > infix_to_postfix.c:130< / div > < / div >
< / 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 = "../../db/d0c/infix__to__postfix_8c_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg" width = "332" height = "240" > < p > < b > This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.< / b > < / p > < / iframe >
2021-02-11 13:15:05 +08:00
< / div >
< / div >
< / div >
< / div >
2021-10-26 03:34:27 +08:00
< a id = "a940cdcd27c40699eebb4ef113b2d9451" name = "a940cdcd27c40699eebb4ef113b2d9451" > < / a >
2021-02-11 13:15:05 +08:00
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#a940cdcd27c40699eebb4ef113b2d9451" > ◆ < / a > < / span > pop()< / h2 >
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > int pop < / td >
< td > (< / td >
< td class = "paramtype" > struct < a class = "el" href = "../../dd/d10/struct_stack.html" > Stack< / a > *  < / td >
< td class = "paramname" > < em > p< / em > < / td > < td > )< / td >
< td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > pop function < / p >
< dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > *p< / td > < td > : used as a pointer variable of stack < / td > < / tr >
< / table >
< / dd >
< / dl >
< dl class = "section return" > < dt > Returns< / dt > < dd > x or \0 on exit < / dd > < / dl >
2021-10-26 03:34:27 +08:00
< div class = "fragment" > < div class = "line" > < a id = "l00073" name = "l00073" > < / a > < span class = "lineno" > 73< / span > {< / div >
< div class = "line" > < a id = "l00074" name = "l00074" > < / a > < span class = "lineno" > 74< / span > < span class = "keywordtype" > char< / span > x;< / div >
< div class = "line" > < a id = "l00075" name = "l00075" > < / a > < span class = "lineno" > 75< / span > < / div >
< div class = "line" > < a id = "l00076" name = "l00076" > < / a > < span class = "lineno" > 76< / span > < span class = "keywordflow" > if< / span > (p-> < a class = "code hl_variable" href = "../../dd/d10/struct_stack.html#ac2dbef151bc913684a90b06836725ef9" > tos< / a > == -1)< / div >
< div class = "line" > < a id = "l00077" name = "l00077" > < / a > < span class = "lineno" > 77< / span > {< / div >
< div class = "line" > < a id = "l00078" name = "l00078" > < / a > < span class = "lineno" > 78< / span > printf(< span class = "stringliteral" > " Stack Underflow!" < / span > );< / div >
< div class = "line" > < a id = "l00079" name = "l00079" > < / a > < span class = "lineno" > 79< / span > < span class = "keywordflow" > return< / span > < span class = "charliteral" > ' \0' < / span > ;< / div >
< div class = "line" > < a id = "l00080" name = "l00080" > < / a > < span class = "lineno" > 80< / span > }< / div >
< div class = "line" > < a id = "l00081" name = "l00081" > < / a > < span class = "lineno" > 81< / span > < / div >
< div class = "line" > < a id = "l00082" name = "l00082" > < / a > < span class = "lineno" > 82< / span > x = p-> arr[p-> < a class = "code hl_variable" href = "../../dd/d10/struct_stack.html#ac2dbef151bc913684a90b06836725ef9" > tos< / a > ]; < span class = "comment" > // assign the value of stack at index tos to x< / span > < / div >
< div class = "line" > < a id = "l00083" name = "l00083" > < / a > < span class = "lineno" > 83< / span > p-> < a class = "code hl_variable" href = "../../dd/d10/struct_stack.html#ac2dbef151bc913684a90b06836725ef9" > tos< / a > -= 1; < span class = "comment" > // decrement tos< / span > < / div >
< div class = "line" > < a id = "l00084" name = "l00084" > < / a > < span class = "lineno" > 84< / span > < / div >
< div class = "line" > < a id = "l00085" name = "l00085" > < / a > < span class = "lineno" > 85< / span > < span class = "keywordflow" > return< / span > x;< / div >
< div class = "line" > < a id = "l00086" name = "l00086" > < / a > < span class = "lineno" > 86< / span > }< / div >
2021-02-11 13:15:05 +08:00
< / div > <!-- fragment -->
< / div >
< / div >
2021-10-26 03:34:27 +08:00
< a id = "a613462735d30cae1b85b606ecab30554" name = "a613462735d30cae1b85b606ecab30554" > < / a >
2021-02-11 13:15:05 +08:00
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#a613462735d30cae1b85b606ecab30554" > ◆ < / 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" > struct < a class = "el" href = "../../dd/d10/struct_stack.html" > Stack< / a > *  < / td >
< td class = "paramname" > < em > p< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > char  < / td >
< td class = "paramname" > < em > x< / em >   < / td >
< / tr >
< tr >
< td > < / td >
< td > )< / td >
< td > < / td > < td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > push function < / p >
< dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > *p< / td > < td > : used as a pointer variable of stack < / td > < / tr >
< tr > < td class = "paramname" > x< / td > < td > : char to be pushed in stack < / td > < / tr >
< / table >
< / dd >
< / dl >
< dl class = "section return" > < dt > Returns< / dt > < dd > void < / dd > < / dl >
2021-10-26 03:34:27 +08:00
< div class = "fragment" > < div class = "line" > < a id = "l00056" name = "l00056" > < / a > < span class = "lineno" > 56< / span > {< / div >
< div class = "line" > < a id = "l00057" name = "l00057" > < / a > < span class = "lineno" > 57< / span > < span class = "keywordflow" > if< / span > (p-> < a class = "code hl_variable" href = "../../dd/d10/struct_stack.html#ac2dbef151bc913684a90b06836725ef9" > tos< / a > == 9) < span class = "comment" > // check if stack has reached its max limit< / span > < / div >
< div class = "line" > < a id = "l00058" name = "l00058" > < / a > < span class = "lineno" > 58< / span > {< / div >
< div class = "line" > < a id = "l00059" name = "l00059" > < / a > < span class = "lineno" > 59< / span > printf(< span class = "stringliteral" > " Stack Overflow!" < / span > );< / div >
< div class = "line" > < a id = "l00060" name = "l00060" > < / a > < span class = "lineno" > 60< / span > < span class = "keywordflow" > return< / span > ;< / div >
< div class = "line" > < a id = "l00061" name = "l00061" > < / a > < span class = "lineno" > 61< / span > }< / div >
< div class = "line" > < a id = "l00062" name = "l00062" > < / a > < span class = "lineno" > 62< / span > < / div >
< div class = "line" > < a id = "l00063" name = "l00063" > < / a > < span class = "lineno" > 63< / span > p-> < a class = "code hl_variable" href = "../../dd/d10/struct_stack.html#ac2dbef151bc913684a90b06836725ef9" > tos< / a > += 1; < span class = "comment" > // increment tos< / span > < / div >
< div class = "line" > < a id = "l00064" name = "l00064" > < / a > < span class = "lineno" > 64< / span > p-> arr[p-> < a class = "code hl_variable" href = "../../dd/d10/struct_stack.html#ac2dbef151bc913684a90b06836725ef9" > tos< / a > ] = x; < span class = "comment" > // assign char x to index of stack pointed by tos< / span > < / div >
< div class = "line" > < a id = "l00065" name = "l00065" > < / a > < span class = "lineno" > 65< / span > }< / div >
2021-02-11 13:15:05 +08:00
< / div > <!-- fragment -->
< / 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_9babc524d57e25f3d9f4179cabc3599e.html" > conversions< / a > < / li > < li class = "navelem" > < a class = "el" href = "../../db/d0c/infix__to__postfix_8c.html" > infix_to_postfix.c< / a > < / li >
2021-10-26 03:34: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.2 < / li >
2021-02-11 13:15:05 +08:00
< / ul >
< / div >
< / body >
< / html >