<!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"/> <meta name="generator" content="Doxygen 1.9.2"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>Algorithms_in_C: data_structures/binary_trees/words_alphabetical.c File Reference</title> <link href="../../tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="../../jquery.js"></script> <script type="text/javascript" src="../../dynsections.js"></script> <link href="../../navtree.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="../../resize.js"></script> <script type="text/javascript" src="../../navtreedata.js"></script> <script type="text/javascript" src="../../navtree.js"></script> <link href="../../search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="../../search/searchdata.js"></script> <script type="text/javascript" src="../../search/search.js"></script> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"], jax: ["input/TeX","output/HTML-CSS"], }); </script> <script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js"></script> <link href="../../doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">Algorithms_in_C<span id="projectnumber"> 1.0.0</span> </div> <div id="projectbrief">Set of algorithms implemented in C.</div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.9.2 --> <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('d3/d78/words__alphabetical_8c.html','../../'); initResizable(); }); /* @license-end */ </script> <div id="doc-content"> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div class="header"> <div class="summary"> <a href="#nested-classes">Data Structures</a> | <a href="#func-members">Functions</a> </div> <div class="headertitle"><div class="title">words_alphabetical.c File Reference</div></div> </div><!--header--> <div class="contents"> <p>Printing the <a href="http://www.dailyfreecode.com/Code/word-list-reads-text-file-makes-2050.aspx" target="_blank">words contained in a file</a> named <code>file.txt</code> in alphabetical order and also their frequencies in to another file "wordcount.txt". <a href="#details">More...</a></p> <div class="textblock"><code>#include <assert.h></code><br /> <code>#include <ctype.h></code><br /> <code>#include <inttypes.h></code><br /> <code>#include <stdbool.h></code><br /> <code>#include <stdio.h></code><br /> <code>#include <stdlib.h></code><br /> <code>#include <string.h></code><br /> </div><div class="textblock"><div class="dynheader"> Include dependency graph for words_alphabetical.c:</div> <div class="dyncontent"> <div class="center"><iframe scrolling="no" frameborder="0" src="../../d4/d3c/words__alphabetical_8c__incl.svg" width="638" 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"> <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="../../db/d8b/struct_node.html">Node</a></td></tr> <tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight"><a class="el" href="../../db/d8b/struct_node.html" title="Node, the basic data structure of the tree.">Node</a>, the basic data structure of the tree. <a href="../../db/d8b/struct_node.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:a5157a5b4e164f934602fa78413504029"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d78/words__alphabetical_8c.html#a5157a5b4e164f934602fa78413504029">endProgramAbruptly</a> (char *errorMessage)</td></tr> <tr class="memdesc:a5157a5b4e164f934602fa78413504029"><td class="mdescLeft"> </td><td class="mdescRight">Ends program due to an error. <a href="../../d3/d78/words__alphabetical_8c.html#a5157a5b4e164f934602fa78413504029">More...</a><br /></td></tr> <tr class="separator:a5157a5b4e164f934602fa78413504029"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a840902ada0e956eb01b529be178748cc"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d78/words__alphabetical_8c.html#a840902ada0e956eb01b529be178748cc">freeTreeMemory</a> (struct <a class="el" href="../../db/d8b/struct_node.html">Node</a> *<a class="el" href="../../d5/da1/structnode.html">node</a>)</td></tr> <tr class="memdesc:a840902ada0e956eb01b529be178748cc"><td class="mdescLeft"> </td><td class="mdescRight">Frees memory when program is terminating. <a href="../../d3/d78/words__alphabetical_8c.html#a840902ada0e956eb01b529be178748cc">More...</a><br /></td></tr> <tr class="separator:a840902ada0e956eb01b529be178748cc"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a9e3cab68cf6557024f0073f674a307a1"><td class="memItemLeft" align="right" valign="top">char * </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d78/words__alphabetical_8c.html#a9e3cab68cf6557024f0073f674a307a1">getPointerToWord</a> (char *word)</td></tr> <tr class="memdesc:a9e3cab68cf6557024f0073f674a307a1"><td class="mdescLeft"> </td><td class="mdescRight">Stores word in memory. <a href="../../d3/d78/words__alphabetical_8c.html#a9e3cab68cf6557024f0073f674a307a1">More...</a><br /></td></tr> <tr class="separator:a9e3cab68cf6557024f0073f674a307a1"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:af1f9b6eb320d872ba0766dc8bd070075"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d78/words__alphabetical_8c.html#af1f9b6eb320d872ba0766dc8bd070075">closeFile</a> (FILE *file)</td></tr> <tr class="memdesc:af1f9b6eb320d872ba0766dc8bd070075"><td class="mdescLeft"> </td><td class="mdescRight">Closes the file after reading or writing. <a href="../../d3/d78/words__alphabetical_8c.html#af1f9b6eb320d872ba0766dc8bd070075">More...</a><br /></td></tr> <tr class="separator:af1f9b6eb320d872ba0766dc8bd070075"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a1e5ad8401396df36ab585d79f3309fd9"><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="../../db/d8b/struct_node.html">Node</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d78/words__alphabetical_8c.html#a1e5ad8401396df36ab585d79f3309fd9">allocateMemoryForNode</a> ()</td></tr> <tr class="memdesc:a1e5ad8401396df36ab585d79f3309fd9"><td class="mdescLeft"> </td><td class="mdescRight">Reserves memory for new node. <a href="../../d3/d78/words__alphabetical_8c.html#a1e5ad8401396df36ab585d79f3309fd9">More...</a><br /></td></tr> <tr class="separator:a1e5ad8401396df36ab585d79f3309fd9"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a22516c70583c9fa78e4edffb063836cc"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d78/words__alphabetical_8c.html#a22516c70583c9fa78e4edffb063836cc">writeContentOfTreeToFile</a> (struct <a class="el" href="../../db/d8b/struct_node.html">Node</a> *<a class="el" href="../../d5/da1/structnode.html">node</a>, FILE *file)</td></tr> <tr class="memdesc:a22516c70583c9fa78e4edffb063836cc"><td class="mdescLeft"> </td><td class="mdescRight">Writes contents of tree to another file alphabetically. <a href="../../d3/d78/words__alphabetical_8c.html#a22516c70583c9fa78e4edffb063836cc">More...</a><br /></td></tr> <tr class="separator:a22516c70583c9fa78e4edffb063836cc"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a0ac11529daf94e98f7114a6e938679a9"><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="../../db/d8b/struct_node.html">Node</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d78/words__alphabetical_8c.html#a0ac11529daf94e98f7114a6e938679a9">addWordToTree</a> (char *word, struct <a class="el" href="../../db/d8b/struct_node.html">Node</a> *currentNode)</td></tr> <tr class="memdesc:a0ac11529daf94e98f7114a6e938679a9"><td class="mdescLeft"> </td><td class="mdescRight">Adds word (node) to the correct position in tree. <a href="../../d3/d78/words__alphabetical_8c.html#a0ac11529daf94e98f7114a6e938679a9">More...</a><br /></td></tr> <tr class="separator:a0ac11529daf94e98f7114a6e938679a9"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a151b2c78ae821d0495faf936a1c2530f"><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="../../db/d8b/struct_node.html">Node</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d78/words__alphabetical_8c.html#a151b2c78ae821d0495faf936a1c2530f">readWordsInFileToTree</a> (FILE *file, struct <a class="el" href="../../db/d8b/struct_node.html">Node</a> *root)</td></tr> <tr class="memdesc:a151b2c78ae821d0495faf936a1c2530f"><td class="mdescLeft"> </td><td class="mdescRight">Reads words from file to tree. <a href="../../d3/d78/words__alphabetical_8c.html#a151b2c78ae821d0495faf936a1c2530f">More...</a><br /></td></tr> <tr class="separator:a151b2c78ae821d0495faf936a1c2530f"><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="../../d3/d78/words__alphabetical_8c.html#aa8dca7b867074164d5f45b0f3851269d">test</a> ()</td></tr> <tr class="memdesc:aa8dca7b867074164d5f45b0f3851269d"><td class="mdescLeft"> </td><td class="mdescRight">Self-test implementations. <a href="../../d3/d78/words__alphabetical_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="../../d3/d78/words__alphabetical_8c.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a> ()</td></tr> <tr class="memdesc:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="mdescLeft"> </td><td class="mdescRight">Main function. <a href="../../d3/d78/words__alphabetical_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> <div class="textblock"><p >Printing the <a href="http://www.dailyfreecode.com/Code/word-list-reads-text-file-makes-2050.aspx" target="_blank">words contained in a file</a> named <code>file.txt</code> in alphabetical order and also their frequencies in to another file "wordcount.txt". </p> <p >Given a file (<code>file.txt</code>) containing words (like a publication or a novel), where words are separated by a space, newline, or underscore. This program prints (writes or outputs) to another file (<code>wordcount.txt</code>), the individual words contained in 'file.txt' with their frequencies (number of occurences) each on a newline and in alphabetical order. This program uses the binary tree data structure to accomplish this task. </p><dl class="section author"><dt>Author</dt><dd><a href="https://github.com/RandyKdev" target="_blank">Randy Kwalar</a> </dd></dl> </div><h2 class="groupheader">Function Documentation</h2> <a id="a0ac11529daf94e98f7114a6e938679a9" name="a0ac11529daf94e98f7114a6e938679a9"></a> <h2 class="memtitle"><span class="permalink"><a href="#a0ac11529daf94e98f7114a6e938679a9">◆ </a></span>addWordToTree()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">struct <a class="el" href="../../db/d8b/struct_node.html">Node</a> * addWordToTree </td> <td>(</td> <td class="paramtype">char * </td> <td class="paramname"><em>word</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">struct <a class="el" href="../../db/d8b/struct_node.html">Node</a> * </td> <td class="paramname"><em>currentNode</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Adds word (node) to the correct position in tree. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">word</td><td>word to be inserted in to the tree </td></tr> <tr><td class="paramname">currentNode</td><td>node which is being compared </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>a pointer to the root node </dd></dl> <p >< holds compare state</p> <div class="fragment"><div class="line"><a id="l00145" name="l00145"></a><span class="lineno"> 145</span>{</div> <div class="line"><a id="l00146" name="l00146"></a><span class="lineno"> 146</span> <span class="keywordflow">if</span> (currentNode == NULL) <span class="comment">// checks if `currentNode` is `NULL`</span></div> <div class="line"><a id="l00147" name="l00147"></a><span class="lineno"> 147</span> {</div> <div class="line"><a id="l00148" name="l00148"></a><span class="lineno"> 148</span> <span class="keyword">struct </span><a class="code hl_struct" href="../../db/d8b/struct_node.html">Node</a> *currentNode =</div> <div class="line"><a id="l00149" name="l00149"></a><span class="lineno"> 149</span> <a class="code hl_function" href="../../d3/d78/words__alphabetical_8c.html#a1e5ad8401396df36ab585d79f3309fd9">allocateMemoryForNode</a>(); <span class="comment">// allocates memory for new node</span></div> <div class="line"><a id="l00150" name="l00150"></a><span class="lineno"> 150</span> currentNode-><a class="code hl_variable" href="../../db/d8b/struct_node.html#afa6ccc6414d3e0bcacb715dcdf764bca">word</a> = <a class="code hl_function" href="../../d3/d78/words__alphabetical_8c.html#a9e3cab68cf6557024f0073f674a307a1">getPointerToWord</a>(<a class="code hl_variable" href="../../db/d8b/struct_node.html#afa6ccc6414d3e0bcacb715dcdf764bca">word</a>); <span class="comment">// stores `word` in memory</span></div> <div class="line"><a id="l00151" name="l00151"></a><span class="lineno"> 151</span> currentNode-><a class="code hl_variable" href="../../db/d8b/struct_node.html#abe1c200da58f5276c6fd74f640a29a02">frequency</a> = 1; <span class="comment">// initializes the word frequency to 1</span></div> <div class="line"><a id="l00152" name="l00152"></a><span class="lineno"> 152</span> currentNode-><a class="code hl_variable" href="../../db/d8b/struct_node.html#ad0976834843c7618677d22a10c495b36">left</a> = NULL; <span class="comment">// sets left node to `NULL`</span></div> <div class="line"><a id="l00153" name="l00153"></a><span class="lineno"> 153</span> currentNode-><a class="code hl_variable" href="../../db/d8b/struct_node.html#af99e7102380da88d7c079fa264230cf4">right</a> = NULL; <span class="comment">// sets right node to `NULL`</span></div> <div class="line"><a id="l00154" name="l00154"></a><span class="lineno"> 154</span> <span class="keywordflow">return</span> currentNode; <span class="comment">// returns pointer to newly created node</span></div> <div class="line"><a id="l00155" name="l00155"></a><span class="lineno"> 155</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> int64_t compared = strcmp(<a class="code hl_variable" href="../../db/d8b/struct_node.html#afa6ccc6414d3e0bcacb715dcdf764bca">word</a>, currentNode-><a class="code hl_variable" href="../../db/d8b/struct_node.html#afa6ccc6414d3e0bcacb715dcdf764bca">word</a>); <span class="comment">///< holds compare state</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> <span class="keywordflow">if</span> (compared > 0) {</div> <div class="line"><a id="l00160" name="l00160"></a><span class="lineno"> 160</span> currentNode-><a class="code hl_variable" href="../../db/d8b/struct_node.html#af99e7102380da88d7c079fa264230cf4">right</a> = <a class="code hl_function" href="../../d3/d78/words__alphabetical_8c.html#a0ac11529daf94e98f7114a6e938679a9">addWordToTree</a>(<a class="code hl_variable" href="../../db/d8b/struct_node.html#afa6ccc6414d3e0bcacb715dcdf764bca">word</a>,</div> <div class="line"><a id="l00161" name="l00161"></a><span class="lineno"> 161</span> currentNode-><a class="code hl_variable" href="../../db/d8b/struct_node.html#af99e7102380da88d7c079fa264230cf4">right</a>); <span class="comment">// adds `word` to right sub tree if `word` is</span></div> <div class="line"><a id="l00162" name="l00162"></a><span class="lineno"> 162</span> <span class="comment">// alphabetically greater than `currentNode->word`</span></div> <div class="line"><a id="l00163" name="l00163"></a><span class="lineno"> 163</span> }</div> <div class="line"><a id="l00164" name="l00164"></a><span class="lineno"> 164</span> <span class="keywordflow">else</span> <span class="keywordflow">if</span> (compared < 0) {</div> <div class="line"><a id="l00165" name="l00165"></a><span class="lineno"> 165</span> currentNode-><a class="code hl_variable" href="../../db/d8b/struct_node.html#ad0976834843c7618677d22a10c495b36">left</a> = <a class="code hl_function" href="../../d3/d78/words__alphabetical_8c.html#a0ac11529daf94e98f7114a6e938679a9">addWordToTree</a>(<a class="code hl_variable" href="../../db/d8b/struct_node.html#afa6ccc6414d3e0bcacb715dcdf764bca">word</a>,</div> <div class="line"><a id="l00166" name="l00166"></a><span class="lineno"> 166</span> currentNode-><a class="code hl_variable" href="../../db/d8b/struct_node.html#ad0976834843c7618677d22a10c495b36">left</a>); <span class="comment">// adds `word` to left sub tree if `word` is</span></div> <div class="line"><a id="l00167" name="l00167"></a><span class="lineno"> 167</span> <span class="comment">// alphabetically less than `currentNode->word`</span></div> <div class="line"><a id="l00168" name="l00168"></a><span class="lineno"> 168</span> }</div> <div class="line"><a id="l00169" name="l00169"></a><span class="lineno"> 169</span> <span class="keywordflow">else</span> {</div> <div class="line"><a id="l00170" name="l00170"></a><span class="lineno"> 170</span> currentNode-><a class="code hl_variable" href="../../db/d8b/struct_node.html#abe1c200da58f5276c6fd74f640a29a02">frequency</a>++; <span class="comment">// increments `currentNode` frequency if `word` is the same as `currentNode->word`</span></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> </div> <div class="line"><a id="l00173" name="l00173"></a><span class="lineno"> 173</span> <span class="keywordflow">return</span> currentNode; <span class="comment">// returns pointer to current node</span></div> <div class="line"><a id="l00174" name="l00174"></a><span class="lineno"> 174</span>}</div> <div class="ttc" id="astruct_node_html"><div class="ttname"><a href="../../db/d8b/struct_node.html">Node</a></div><div class="ttdoc">Node, the basic data structure of the tree.</div><div class="ttdef"><b>Definition:</b> threaded_binary_trees.c:27</div></div> <div class="ttc" id="astruct_node_html_abe1c200da58f5276c6fd74f640a29a02"><div class="ttname"><a href="../../db/d8b/struct_node.html#abe1c200da58f5276c6fd74f640a29a02">Node::frequency</a></div><div class="ttdeci">uint64_t frequency</div><div class="ttdoc">number of occurences of the word</div><div class="ttdef"><b>Definition:</b> words_alphabetical.c:31</div></div> <div class="ttc" id="astruct_node_html_ad0976834843c7618677d22a10c495b36"><div class="ttname"><a href="../../db/d8b/struct_node.html#ad0976834843c7618677d22a10c495b36">Node::left</a></div><div class="ttdeci">struct Node * left</div><div class="ttdoc">pointer to the left child node</div><div class="ttdef"><b>Definition:</b> words_alphabetical.c:32</div></div> <div class="ttc" id="astruct_node_html_af99e7102380da88d7c079fa264230cf4"><div class="ttname"><a href="../../db/d8b/struct_node.html#af99e7102380da88d7c079fa264230cf4">Node::right</a></div><div class="ttdeci">struct Node * right</div><div class="ttdoc">pointer to the right child node</div><div class="ttdef"><b>Definition:</b> words_alphabetical.c:33</div></div> <div class="ttc" id="astruct_node_html_afa6ccc6414d3e0bcacb715dcdf764bca"><div class="ttname"><a href="../../db/d8b/struct_node.html#afa6ccc6414d3e0bcacb715dcdf764bca">Node::word</a></div><div class="ttdeci">char * word</div><div class="ttdoc">the word (value) of the node</div><div class="ttdef"><b>Definition:</b> words_alphabetical.c:30</div></div> <div class="ttc" id="awords__alphabetical_8c_html_a0ac11529daf94e98f7114a6e938679a9"><div class="ttname"><a href="../../d3/d78/words__alphabetical_8c.html#a0ac11529daf94e98f7114a6e938679a9">addWordToTree</a></div><div class="ttdeci">struct Node * addWordToTree(char *word, struct Node *currentNode)</div><div class="ttdoc">Adds word (node) to the correct position in tree.</div><div class="ttdef"><b>Definition:</b> words_alphabetical.c:144</div></div> <div class="ttc" id="awords__alphabetical_8c_html_a1e5ad8401396df36ab585d79f3309fd9"><div class="ttname"><a href="../../d3/d78/words__alphabetical_8c.html#a1e5ad8401396df36ab585d79f3309fd9">allocateMemoryForNode</a></div><div class="ttdeci">struct Node * allocateMemoryForNode()</div><div class="ttdoc">Reserves memory for new node.</div><div class="ttdef"><b>Definition:</b> words_alphabetical.c:102</div></div> <div class="ttc" id="awords__alphabetical_8c_html_a9e3cab68cf6557024f0073f674a307a1"><div class="ttname"><a href="../../d3/d78/words__alphabetical_8c.html#a9e3cab68cf6557024f0073f674a307a1">getPointerToWord</a></div><div class="ttdeci">char * getPointerToWord(char *word)</div><div class="ttdoc">Stores word in memory.</div><div class="ttdef"><b>Definition:</b> words_alphabetical.c:70</div></div> </div><!-- fragment --><div class="dynheader"> Here is the call graph for this function:</div> <div class="dyncontent"> <div class="center"><iframe scrolling="no" frameborder="0" src="../../d3/d78/words__alphabetical_8c_a0ac11529daf94e98f7114a6e938679a9_cgraph.svg" width="536" height="88"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe> </div> </div> </div> </div> <a id="a1e5ad8401396df36ab585d79f3309fd9" name="a1e5ad8401396df36ab585d79f3309fd9"></a> <h2 class="memtitle"><span class="permalink"><a href="#a1e5ad8401396df36ab585d79f3309fd9">◆ </a></span>allocateMemoryForNode()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">struct <a class="el" href="../../db/d8b/struct_node.html">Node</a> * allocateMemoryForNode </td> <td>(</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Reserves memory for new node. </p> <dl class="section return"><dt>Returns</dt><dd>a pointer to the newly allocated node if memory IS successfully reserved </dd> <dd> <code>NULL</code> if memory is NOT reserved </dd></dl> <p >< pointer to the node</p> <div class="fragment"><div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span>{</div> <div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> <span class="keyword">struct </span><a class="code hl_struct" href="../../db/d8b/struct_node.html">Node</a> *<a class="code hl_struct" href="../../d5/da1/structnode.html">node</a> =</div> <div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> (<span class="keyword">struct </span><a class="code hl_struct" href="../../db/d8b/struct_node.html">Node</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="../../db/d8b/struct_node.html">Node</a>)); <span class="comment">///< pointer to the node</span></div> <div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> <span class="keywordflow">if</span> (<a class="code hl_struct" href="../../d5/da1/structnode.html">node</a> != NULL)</div> <div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> {</div> <div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span> <span class="keywordflow">return</span> <a class="code hl_typedef" href="../../da/d02/binary__search__tree_8c.html#af4aeda155dbe167f1c1cf38cb65bf324">node</a>;</div> <div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span> }</div> <div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> <a class="code hl_function" href="../../d3/d78/words__alphabetical_8c.html#a5157a5b4e164f934602fa78413504029">endProgramAbruptly</a>(</div> <div class="line"><a id="l00111" name="l00111"></a><span class="lineno"> 111</span> <span class="stringliteral">"\nA problem occurred while reserving memory for the structure\n"</span>);</div> <div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span> <span class="keywordflow">return</span> NULL;</div> <div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span>}</div> <div class="ttc" id="abinary__search__tree_8c_html_af4aeda155dbe167f1c1cf38cb65bf324"><div class="ttname"><a href="../../da/d02/binary__search__tree_8c.html#af4aeda155dbe167f1c1cf38cb65bf324">node</a></div><div class="ttdeci">struct node node</div><div class="ttdoc">Node, the basic data structure in the tree.</div></div> <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> <div class="ttc" id="astructnode_html"><div class="ttname"><a href="../../d5/da1/structnode.html">node</a></div><div class="ttdoc">Node, the basic data structure in the tree.</div><div class="ttdef"><b>Definition:</b> binary_search_tree.c:15</div></div> <div class="ttc" id="awords__alphabetical_8c_html_a5157a5b4e164f934602fa78413504029"><div class="ttname"><a href="../../d3/d78/words__alphabetical_8c.html#a5157a5b4e164f934602fa78413504029">endProgramAbruptly</a></div><div class="ttdeci">void endProgramAbruptly(char *errorMessage)</div><div class="ttdoc">Ends program due to an error.</div><div class="ttdef"><b>Definition:</b> words_alphabetical.c:41</div></div> </div><!-- fragment --><div class="dynheader"> Here is the call graph for this function:</div> <div class="dyncontent"> <div class="center"><iframe scrolling="no" frameborder="0" src="../../d3/d78/words__alphabetical_8c_a1e5ad8401396df36ab585d79f3309fd9_cgraph.svg" width="371" height="38"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe> </div> </div> </div> </div> <a id="af1f9b6eb320d872ba0766dc8bd070075" name="af1f9b6eb320d872ba0766dc8bd070075"></a> <h2 class="memtitle"><span class="permalink"><a href="#af1f9b6eb320d872ba0766dc8bd070075">◆ </a></span>closeFile()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void closeFile </td> <td>(</td> <td class="paramtype">FILE * </td> <td class="paramname"><em>file</em></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Closes the file after reading or writing. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">file</td><td>pointer to the file to be closed </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>void </dd></dl> <div class="fragment"><div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span>{</div> <div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> <span class="keywordflow">if</span> (fclose(file)) {</div> <div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span> <a class="code hl_function" href="../../d3/d78/words__alphabetical_8c.html#a5157a5b4e164f934602fa78413504029">endProgramAbruptly</a>(<span class="stringliteral">"\nA Problem Occurred while closing a file\n"</span>);</div> <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>}</div> </div><!-- fragment --><div class="dynheader"> Here is the call graph for this function:</div> <div class="dyncontent"> <div class="center"><iframe scrolling="no" frameborder="0" src="../../d3/d78/words__alphabetical_8c_af1f9b6eb320d872ba0766dc8bd070075_cgraph.svg" width="278" height="38"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe> </div> </div> </div> </div> <a id="a5157a5b4e164f934602fa78413504029" name="a5157a5b4e164f934602fa78413504029"></a> <h2 class="memtitle"><span class="permalink"><a href="#a5157a5b4e164f934602fa78413504029">◆ </a></span>endProgramAbruptly()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void endProgramAbruptly </td> <td>(</td> <td class="paramtype">char * </td> <td class="paramname"><em>errorMessage</em></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Ends program due to an error. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">errorMessage</td><td>the error message to be printed </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>void </dd></dl> <div class="fragment"><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> fprintf(stderr, <span class="stringliteral">"%s\n"</span>, errorMessage);</div> <div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> exit(EXIT_FAILURE);</div> <div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span>}</div> </div><!-- fragment --> </div> </div> <a id="a840902ada0e956eb01b529be178748cc" name="a840902ada0e956eb01b529be178748cc"></a> <h2 class="memtitle"><span class="permalink"><a href="#a840902ada0e956eb01b529be178748cc">◆ </a></span>freeTreeMemory()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void freeTreeMemory </td> <td>(</td> <td class="paramtype">struct <a class="el" href="../../db/d8b/struct_node.html">Node</a> * </td> <td class="paramname"><em>node</em></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Frees memory when program is terminating. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">node</td><td>pointer to current node </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>void </dd></dl> <div class="fragment"><div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span>{</div> <div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> <span class="keywordflow">if</span> (<a class="code hl_struct" href="../../d5/da1/structnode.html">node</a> != NULL)</div> <div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> {</div> <div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> <a class="code hl_function" href="../../d3/d78/words__alphabetical_8c.html#a840902ada0e956eb01b529be178748cc">freeTreeMemory</a>(<a class="code hl_struct" href="../../d5/da1/structnode.html">node</a>-><a class="code hl_variable" href="../../d5/da1/structnode.html#af7109e6ffd82cbbb705e486fd0ce92f0">left</a>);</div> <div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> <a class="code hl_function" href="../../d3/d78/words__alphabetical_8c.html#a840902ada0e956eb01b529be178748cc">freeTreeMemory</a>(<a class="code hl_struct" href="../../d5/da1/structnode.html">node</a>-><a class="code hl_variable" href="../../d5/da1/structnode.html#a51e160f22dc6064bac4a4f9f1d931c2c">right</a>);</div> <div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> <a class="code hl_define" href="../../d2/ddd/malloc__dbg_8h.html#a9cc854374299a1dd933bf62029761768">free</a>(<a class="code hl_struct" href="../../d5/da1/structnode.html">node</a>->word); <span class="comment">// freeing node->word because memory was allocated</span></div> <div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> <span class="comment">// using malloc</span></div> <div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> <a class="code hl_define" href="../../d2/ddd/malloc__dbg_8h.html#a9cc854374299a1dd933bf62029761768">free</a>(<a class="code hl_struct" href="../../d5/da1/structnode.html">node</a>); <span class="comment">// freeing node because memory was allocated using malloc</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="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> <div class="ttc" id="astructnode_html_a51e160f22dc6064bac4a4f9f1d931c2c"><div class="ttname"><a href="../../d5/da1/structnode.html#a51e160f22dc6064bac4a4f9f1d931c2c">node::right</a></div><div class="ttdeci">struct node * right</div><div class="ttdoc">right child</div><div class="ttdef"><b>Definition:</b> binary_search_tree.c:17</div></div> <div class="ttc" id="astructnode_html_af7109e6ffd82cbbb705e486fd0ce92f0"><div class="ttname"><a href="../../d5/da1/structnode.html#af7109e6ffd82cbbb705e486fd0ce92f0">node::left</a></div><div class="ttdeci">struct node * left</div><div class="ttdoc">left child</div><div class="ttdef"><b>Definition:</b> binary_search_tree.c:16</div></div> <div class="ttc" id="awords__alphabetical_8c_html_a840902ada0e956eb01b529be178748cc"><div class="ttname"><a href="../../d3/d78/words__alphabetical_8c.html#a840902ada0e956eb01b529be178748cc">freeTreeMemory</a></div><div class="ttdeci">void freeTreeMemory(struct Node *node)</div><div class="ttdoc">Frees memory when program is terminating.</div><div class="ttdef"><b>Definition:</b> words_alphabetical.c:52</div></div> </div><!-- fragment --><div class="dynheader"> Here is the call graph for this function:</div> <div class="dyncontent"> <div class="center"><iframe scrolling="no" frameborder="0" src="../../d3/d78/words__alphabetical_8c_a840902ada0e956eb01b529be178748cc_cgraph.svg" width="131" height="62"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe> </div> </div> </div> </div> <a id="a9e3cab68cf6557024f0073f674a307a1" name="a9e3cab68cf6557024f0073f674a307a1"></a> <h2 class="memtitle"><span class="permalink"><a href="#a9e3cab68cf6557024f0073f674a307a1">◆ </a></span>getPointerToWord()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">char * getPointerToWord </td> <td>(</td> <td class="paramtype">char * </td> <td class="paramname"><em>word</em></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Stores word in memory. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">word</td><td>word to be stored in memory </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>a pointer to the newly allocated word if the word IS stored successfully </dd> <dd> <code>NULL</code> if the word is NOT stored </dd></dl> <p >< pointer to string</p> <div class="fragment"><div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span>{</div> <div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> <span class="keywordtype">char</span> *<span class="keywordtype">string</span> =</div> <div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> (<span class="keywordtype">char</span> *)<a class="code hl_define" href="../../d2/ddd/malloc__dbg_8h.html#a725f50ecaf1959d96de79b36b4788fee">malloc</a>((strlen(word) + 1) * <span class="keyword">sizeof</span>(char)); <span class="comment">///< pointer to string</span></div> <div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> <span class="comment">// + 1 is for the '\0' character</span></div> <div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> <span class="keywordflow">if</span> (<span class="keywordtype">string</span> != NULL)</div> <div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> {</div> <div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> strcpy(<span class="keywordtype">string</span>, word);</div> <div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> <span class="keywordflow">return</span> string;</div> <div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> }</div> <div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> <a class="code hl_function" href="../../d3/d78/words__alphabetical_8c.html#a5157a5b4e164f934602fa78413504029">endProgramAbruptly</a>(</div> <div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> <span class="stringliteral">"\nA problem occurred while reserving memory for the word\n"</span>);</div> <div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> <span class="keywordflow">return</span> NULL;</div> <div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span>}</div> </div><!-- fragment --><div class="dynheader"> Here is the call graph for this function:</div> <div class="dyncontent"> <div class="center"><iframe scrolling="no" frameborder="0" src="../../d3/d78/words__alphabetical_8c_a9e3cab68cf6557024f0073f674a307a1_cgraph.svg" width="331" height="38"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe> </div> </div> </div> </div> <a id="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> <div class="fragment"><div class="line"><a id="l00313" name="l00313"></a><span class="lineno"> 313</span>{</div> <div class="line"><a id="l00314" name="l00314"></a><span class="lineno"> 314</span> <a class="code hl_function" href="../../d3/d78/words__alphabetical_8c.html#aa8dca7b867074164d5f45b0f3851269d">test</a>(); <span class="comment">// run self-test implementations</span></div> <div class="line"><a id="l00315" name="l00315"></a><span class="lineno"> 315</span> <span class="keywordflow">return</span> 0;</div> <div class="line"><a id="l00316" name="l00316"></a><span class="lineno"> 316</span>}</div> <div class="ttc" id="awords__alphabetical_8c_html_aa8dca7b867074164d5f45b0f3851269d"><div class="ttname"><a href="../../d3/d78/words__alphabetical_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> words_alphabetical.c:244</div></div> </div><!-- fragment --><div class="dynheader"> Here is the call graph for this function:</div> <div class="dyncontent"> <div class="center"><div class="zoom"><iframe scrolling="no" frameborder="0" src="../../d3/d78/words__alphabetical_8c_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg" width="100%" height="475"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div> </div> </div> </div> </div> <a id="a151b2c78ae821d0495faf936a1c2530f" name="a151b2c78ae821d0495faf936a1c2530f"></a> <h2 class="memtitle"><span class="permalink"><a href="#a151b2c78ae821d0495faf936a1c2530f">◆ </a></span>readWordsInFileToTree()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">struct <a class="el" href="../../db/d8b/struct_node.html">Node</a> * readWordsInFileToTree </td> <td>(</td> <td class="paramtype">FILE * </td> <td class="paramname"><em>file</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">struct <a class="el" href="../../db/d8b/struct_node.html">Node</a> * </td> <td class="paramname"><em>root</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Reads words from file to tree. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">file</td><td>file to be read from </td></tr> <tr><td class="paramname">root</td><td>root node of tree </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>a pointer to the root node </dd></dl> <p >< pointer to the input string</p> <p >< temp storage of characters</p> <p >< bool to mark the end of a word</p> <p >< position in inputString to place the inputChar</p> <div class="fragment"><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> <span class="comment">// longest english word = 45 chars</span></div> <div class="line"><a id="l00185" name="l00185"></a><span class="lineno"> 185</span> <span class="comment">// +1 for '\0' = 46 chars</span></div> <div class="line"><a id="l00186" name="l00186"></a><span class="lineno"> 186</span> <span class="keywordtype">char</span> *inputString =</div> <div class="line"><a id="l00187" name="l00187"></a><span class="lineno"> 187</span> (<span class="keywordtype">char</span> *)<a class="code hl_define" href="../../d2/ddd/malloc__dbg_8h.html#a725f50ecaf1959d96de79b36b4788fee">malloc</a>(46 * <span class="keyword">sizeof</span>(<span class="keywordtype">char</span>)); <span class="comment">///< pointer to the input string</span></div> <div class="line"><a id="l00188" name="l00188"></a><span class="lineno"> 188</span> </div> <div class="line"><a id="l00189" name="l00189"></a><span class="lineno"> 189</span> <span class="keywordtype">char</span> inputChar; <span class="comment">///< temp storage of characters</span></div> <div class="line"><a id="l00190" name="l00190"></a><span class="lineno"> 190</span> <span class="keywordtype">bool</span> isPrevCharAlpha = <span class="keyword">false</span>; <span class="comment">///< bool to mark the end of a word</span></div> <div class="line"><a id="l00191" name="l00191"></a><span class="lineno"> 191</span> uint8_t pos = 0; <span class="comment">///< position in inputString to place the inputChar</span></div> <div class="line"><a id="l00192" name="l00192"></a><span class="lineno"> 192</span> </div> <div class="line"><a id="l00193" name="l00193"></a><span class="lineno"> 193</span> <span class="keywordflow">while</span> ((inputChar = fgetc(file)) != EOF)</div> <div class="line"><a id="l00194" name="l00194"></a><span class="lineno"> 194</span> {</div> <div class="line"><a id="l00195" name="l00195"></a><span class="lineno"> 195</span> <span class="keywordflow">if</span> (pos > 0)</div> <div class="line"><a id="l00196" name="l00196"></a><span class="lineno"> 196</span> isPrevCharAlpha = isalpha(inputString[pos - 1]);</div> <div class="line"><a id="l00197" name="l00197"></a><span class="lineno"> 197</span> </div> <div class="line"><a id="l00198" name="l00198"></a><span class="lineno"> 198</span> <span class="comment">// checks if character is letter</span></div> <div class="line"><a id="l00199" name="l00199"></a><span class="lineno"> 199</span> <span class="keywordflow">if</span> (isalpha(inputChar))</div> <div class="line"><a id="l00200" name="l00200"></a><span class="lineno"> 200</span> {</div> <div class="line"><a id="l00201" name="l00201"></a><span class="lineno"> 201</span> inputString[pos++] = tolower(inputChar);</div> <div class="line"><a id="l00202" name="l00202"></a><span class="lineno"> 202</span> <span class="keywordflow">continue</span>;</div> <div class="line"><a id="l00203" name="l00203"></a><span class="lineno"> 203</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="comment">// checks if character is ' or - and if it is preceded by a letter eg</span></div> <div class="line"><a id="l00206" name="l00206"></a><span class="lineno"> 206</span> <span class="comment">// yours-not, persons' (valid)</span></div> <div class="line"><a id="l00207" name="l00207"></a><span class="lineno"> 207</span> <span class="keywordflow">if</span> ((inputChar == <span class="charliteral">'\''</span> || inputChar == <span class="charliteral">'-'</span>) && isPrevCharAlpha)</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> inputString[pos++] = inputChar;</div> <div class="line"><a id="l00210" name="l00210"></a><span class="lineno"> 210</span> <span class="keywordflow">continue</span>;</div> <div class="line"><a id="l00211" name="l00211"></a><span class="lineno"> 211</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="comment">// makes sure that there is something valid in inputString</span></div> <div class="line"><a id="l00214" name="l00214"></a><span class="lineno"> 214</span> <span class="keywordflow">if</span> (pos == 0)</div> <div class="line"><a id="l00215" name="l00215"></a><span class="lineno"> 215</span> <span class="keywordflow">continue</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="comment">// if last character is not letter and is not ' then replace by \0</span></div> <div class="line"><a id="l00218" name="l00218"></a><span class="lineno"> 218</span> <span class="keywordflow">if</span> (!isPrevCharAlpha && inputString[pos - 1] != <span class="charliteral">'\''</span>)</div> <div class="line"><a id="l00219" name="l00219"></a><span class="lineno"> 219</span> pos--;</div> <div class="line"><a id="l00220" name="l00220"></a><span class="lineno"> 220</span> inputString[pos] = <span class="charliteral">'\0'</span>;</div> <div class="line"><a id="l00221" name="l00221"></a><span class="lineno"> 221</span> pos = 0;</div> <div class="line"><a id="l00222" name="l00222"></a><span class="lineno"> 222</span> isPrevCharAlpha = <span class="keyword">false</span>;</div> <div class="line"><a id="l00223" name="l00223"></a><span class="lineno"> 223</span> root = <a class="code hl_function" href="../../d3/d78/words__alphabetical_8c.html#a0ac11529daf94e98f7114a6e938679a9">addWordToTree</a>(inputString, root);</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> </div> <div class="line"><a id="l00226" name="l00226"></a><span class="lineno"> 226</span> <span class="comment">// this is to catch the case for the EOF being immediately after the last</span></div> <div class="line"><a id="l00227" name="l00227"></a><span class="lineno"> 227</span> <span class="comment">// letter or '</span></div> <div class="line"><a id="l00228" name="l00228"></a><span class="lineno"> 228</span> <span class="keywordflow">if</span> (pos > 0)</div> <div class="line"><a id="l00229" name="l00229"></a><span class="lineno"> 229</span> {</div> <div class="line"><a id="l00230" name="l00230"></a><span class="lineno"> 230</span> <span class="keywordflow">if</span> (!isPrevCharAlpha && inputString[pos - 1] != <span class="charliteral">'\''</span>)</div> <div class="line"><a id="l00231" name="l00231"></a><span class="lineno"> 231</span> pos--;</div> <div class="line"><a id="l00232" name="l00232"></a><span class="lineno"> 232</span> inputString[pos] = <span class="charliteral">'\0'</span>;</div> <div class="line"><a id="l00233" name="l00233"></a><span class="lineno"> 233</span> root = <a class="code hl_function" href="../../d3/d78/words__alphabetical_8c.html#a0ac11529daf94e98f7114a6e938679a9">addWordToTree</a>(inputString, root);</div> <div class="line"><a id="l00234" name="l00234"></a><span class="lineno"> 234</span> }</div> <div class="line"><a id="l00235" name="l00235"></a><span class="lineno"> 235</span> </div> <div class="line"><a id="l00236" name="l00236"></a><span class="lineno"> 236</span> <a class="code hl_define" href="../../d2/ddd/malloc__dbg_8h.html#a9cc854374299a1dd933bf62029761768">free</a>(inputString);</div> <div class="line"><a id="l00237" name="l00237"></a><span class="lineno"> 237</span> <span class="keywordflow">return</span> root;</div> <div class="line"><a id="l00238" name="l00238"></a><span class="lineno"> 238</span>}</div> </div><!-- fragment --><div class="dynheader"> Here is the call graph for this function:</div> <div class="dyncontent"> <div class="center"><div class="zoom"><iframe scrolling="no" frameborder="0" src="../../d3/d78/words__alphabetical_8c_a151b2c78ae821d0495faf936a1c2530f_cgraph.svg" width="100%" height="366"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div> </div> </div> </div> </div> <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 >< pointer to the root node</p> <p >< pointer to the file</p> <div class="fragment"><div class="line"><a id="l00245" name="l00245"></a><span class="lineno"> 245</span>{</div> <div class="line"><a id="l00246" name="l00246"></a><span class="lineno"> 246</span> <span class="keyword">struct </span><a class="code hl_struct" href="../../db/d8b/struct_node.html">Node</a> *root = NULL; <span class="comment">///< pointer to the root node</span></div> <div class="line"><a id="l00247" name="l00247"></a><span class="lineno"> 247</span> FILE *file = NULL; <span class="comment">///< pointer to the file</span></div> <div class="line"><a id="l00248" name="l00248"></a><span class="lineno"> 248</span> </div> <div class="line"><a id="l00249" name="l00249"></a><span class="lineno"> 249</span> file = fopen(<span class="stringliteral">"file.txt"</span>, <span class="stringliteral">"w"</span>); <span class="comment">// creates test file in write mode</span></div> <div class="line"><a id="l00250" name="l00250"></a><span class="lineno"> 250</span> </div> <div class="line"><a id="l00251" name="l00251"></a><span class="lineno"> 251</span> fprintf(file,</div> <div class="line"><a id="l00252" name="l00252"></a><span class="lineno"> 252</span> <span class="stringliteral">"hey_this, is a. test input \n to a_file"</span>); <span class="comment">// writes test data to</span></div> <div class="line"><a id="l00253" name="l00253"></a><span class="lineno"> 253</span> <span class="comment">// test file</span></div> <div class="line"><a id="l00254" name="l00254"></a><span class="lineno"> 254</span> </div> <div class="line"><a id="l00255" name="l00255"></a><span class="lineno"> 255</span> <a class="code hl_function" href="../../d3/d78/words__alphabetical_8c.html#af1f9b6eb320d872ba0766dc8bd070075">closeFile</a>(file); <span class="comment">// closes test file</span></div> <div class="line"><a id="l00256" name="l00256"></a><span class="lineno"> 256</span> file = fopen(<span class="stringliteral">"file.txt"</span>, <span class="stringliteral">"r"</span>); <span class="comment">// reopens test file in read mode</span></div> <div class="line"><a id="l00257" name="l00257"></a><span class="lineno"> 257</span> </div> <div class="line"><a id="l00258" name="l00258"></a><span class="lineno"> 258</span> root = <a class="code hl_function" href="../../d3/d78/words__alphabetical_8c.html#a151b2c78ae821d0495faf936a1c2530f">readWordsInFileToTree</a>(file,</div> <div class="line"><a id="l00259" name="l00259"></a><span class="lineno"> 259</span> root); <span class="comment">// reads words from test file to tree</span></div> <div class="line"><a id="l00260" name="l00260"></a><span class="lineno"> 260</span> </div> <div class="line"><a id="l00261" name="l00261"></a><span class="lineno"> 261</span> <span class="comment">// Tests to check if words were added to correct position in tree and also</span></div> <div class="line"><a id="l00262" name="l00262"></a><span class="lineno"> 262</span> <span class="comment">// if their frequencies were added correctly</span></div> <div class="line"><a id="l00263" name="l00263"></a><span class="lineno"> 263</span> assert(strcmp(root->word, <span class="stringliteral">"hey"</span>) == 0);</div> <div class="line"><a id="l00264" name="l00264"></a><span class="lineno"> 264</span> assert(root->frequency == 1);</div> <div class="line"><a id="l00265" name="l00265"></a><span class="lineno"> 265</span> assert(strcmp(root->left->word, <span class="stringliteral">"a"</span>) == 0);</div> <div class="line"><a id="l00266" name="l00266"></a><span class="lineno"> 266</span> assert(root->left->frequency == 2);</div> <div class="line"><a id="l00267" name="l00267"></a><span class="lineno"> 267</span> assert(strcmp(root->right->word, <span class="stringliteral">"this"</span>) == 0);</div> <div class="line"><a id="l00268" name="l00268"></a><span class="lineno"> 268</span> assert(strcmp(root->left->right->word, <span class="stringliteral">"file"</span>) == 0);</div> <div class="line"><a id="l00269" name="l00269"></a><span class="lineno"> 269</span> assert(strcmp(root->right->left->word, <span class="stringliteral">"is"</span>) == 0);</div> <div class="line"><a id="l00270" name="l00270"></a><span class="lineno"> 270</span> </div> <div class="line"><a id="l00271" name="l00271"></a><span class="lineno"> 271</span> <a class="code hl_function" href="../../d3/d78/words__alphabetical_8c.html#af1f9b6eb320d872ba0766dc8bd070075">closeFile</a>(file); <span class="comment">// closes test file</span></div> <div class="line"><a id="l00272" name="l00272"></a><span class="lineno"> 272</span> remove(<span class="stringliteral">"file.txt"</span>); <span class="comment">// deletes test file from storage</span></div> <div class="line"><a id="l00273" name="l00273"></a><span class="lineno"> 273</span> </div> <div class="line"><a id="l00274" name="l00274"></a><span class="lineno"> 274</span> file = fopen(<span class="stringliteral">"wordcount.txt"</span>, <span class="stringliteral">"a"</span>); <span class="comment">// creates write file</span></div> <div class="line"><a id="l00275" name="l00275"></a><span class="lineno"> 275</span> fprintf(file, <span class="stringliteral">"%-5s \t %9s \t %s \n"</span>, <span class="stringliteral">"S/N"</span>, <span class="stringliteral">"FREQUENCY"</span>,</div> <div class="line"><a id="l00276" name="l00276"></a><span class="lineno"> 276</span> <span class="stringliteral">"WORD"</span>); <span class="comment">// prints the heading to `wordcount.txt`</span></div> <div class="line"><a id="l00277" name="l00277"></a><span class="lineno"> 277</span> <a class="code hl_function" href="../../d3/d78/words__alphabetical_8c.html#a22516c70583c9fa78e4edffb063836cc">writeContentOfTreeToFile</a>(</div> <div class="line"><a id="l00278" name="l00278"></a><span class="lineno"> 278</span> root, file); <span class="comment">// writes content of tree to file (`wordcount.txt`)</span></div> <div class="line"><a id="l00279" name="l00279"></a><span class="lineno"> 279</span> </div> <div class="line"><a id="l00280" name="l00280"></a><span class="lineno"> 280</span> <span class="comment">// Here is how the output to `wordcount.txt` should look like</span></div> <div class="line"><a id="l00281" name="l00281"></a><span class="lineno"> 281</span> <span class="keywordtype">char</span> *correctString =</div> <div class="line"><a id="l00282" name="l00282"></a><span class="lineno"> 282</span> <span class="stringliteral">"S/N FREQUENCY WORD \n"</span></div> <div class="line"><a id="l00283" name="l00283"></a><span class="lineno"> 283</span> <span class="stringliteral">"1 2 a \n"</span></div> <div class="line"><a id="l00284" name="l00284"></a><span class="lineno"> 284</span> <span class="stringliteral">"2 1 file \n"</span></div> <div class="line"><a id="l00285" name="l00285"></a><span class="lineno"> 285</span> <span class="stringliteral">"3 1 hey \n"</span></div> <div class="line"><a id="l00286" name="l00286"></a><span class="lineno"> 286</span> <span class="stringliteral">"4 1 input \n"</span></div> <div class="line"><a id="l00287" name="l00287"></a><span class="lineno"> 287</span> <span class="stringliteral">"5 1 is \n"</span></div> <div class="line"><a id="l00288" name="l00288"></a><span class="lineno"> 288</span> <span class="stringliteral">"6 1 n \n"</span></div> <div class="line"><a id="l00289" name="l00289"></a><span class="lineno"> 289</span> <span class="stringliteral">"7 1 test \n"</span></div> <div class="line"><a id="l00290" name="l00290"></a><span class="lineno"> 290</span> <span class="stringliteral">"8 1 this \n"</span></div> <div class="line"><a id="l00291" name="l00291"></a><span class="lineno"> 291</span> <span class="stringliteral">"9 1 to \n"</span>;</div> <div class="line"><a id="l00292" name="l00292"></a><span class="lineno"> 292</span> </div> <div class="line"><a id="l00293" name="l00293"></a><span class="lineno"> 293</span> int16_t inputChar; <span class="comment">// holds the current character in `wordcount.txt`</span></div> <div class="line"><a id="l00294" name="l00294"></a><span class="lineno"> 294</span> uint64_t i = 0; <span class="comment">// holds the current index in `correctString`</span></div> <div class="line"><a id="l00295" name="l00295"></a><span class="lineno"> 295</span> </div> <div class="line"><a id="l00296" name="l00296"></a><span class="lineno"> 296</span> <span class="comment">// Checks if the content in `wordcount.txt` is as expected (the same as in</span></div> <div class="line"><a id="l00297" name="l00297"></a><span class="lineno"> 297</span> <span class="comment">// `correctString`)</span></div> <div class="line"><a id="l00298" name="l00298"></a><span class="lineno"> 298</span> <span class="keywordflow">while</span> ((inputChar = fgetc(file)) != EOF) {</div> <div class="line"><a id="l00299" name="l00299"></a><span class="lineno"> 299</span> assert(inputChar == correctString[i++]);</div> <div class="line"><a id="l00300" name="l00300"></a><span class="lineno"> 300</span> }</div> <div class="line"><a id="l00301" name="l00301"></a><span class="lineno"> 301</span> </div> <div class="line"><a id="l00302" name="l00302"></a><span class="lineno"> 302</span> <a class="code hl_function" href="../../d3/d78/words__alphabetical_8c.html#af1f9b6eb320d872ba0766dc8bd070075">closeFile</a>(file); <span class="comment">// closes `wordcount.txt`</span></div> <div class="line"><a id="l00303" name="l00303"></a><span class="lineno"> 303</span> remove(<span class="stringliteral">"wordcount.txt"</span>); <span class="comment">// deletes `wordcount.txt`</span></div> <div class="line"><a id="l00304" name="l00304"></a><span class="lineno"> 304</span> </div> <div class="line"><a id="l00305" name="l00305"></a><span class="lineno"> 305</span> <a class="code hl_function" href="../../d3/d78/words__alphabetical_8c.html#a840902ada0e956eb01b529be178748cc">freeTreeMemory</a>(root); <span class="comment">// frees memory taken up by the tree</span></div> <div class="line"><a id="l00306" name="l00306"></a><span class="lineno"> 306</span>}</div> <div class="ttc" id="awords__alphabetical_8c_html_a151b2c78ae821d0495faf936a1c2530f"><div class="ttname"><a href="../../d3/d78/words__alphabetical_8c.html#a151b2c78ae821d0495faf936a1c2530f">readWordsInFileToTree</a></div><div class="ttdeci">struct Node * readWordsInFileToTree(FILE *file, struct Node *root)</div><div class="ttdoc">Reads words from file to tree.</div><div class="ttdef"><b>Definition:</b> words_alphabetical.c:182</div></div> <div class="ttc" id="awords__alphabetical_8c_html_a22516c70583c9fa78e4edffb063836cc"><div class="ttname"><a href="../../d3/d78/words__alphabetical_8c.html#a22516c70583c9fa78e4edffb063836cc">writeContentOfTreeToFile</a></div><div class="ttdeci">void writeContentOfTreeToFile(struct Node *node, FILE *file)</div><div class="ttdoc">Writes contents of tree to another file alphabetically.</div><div class="ttdef"><b>Definition:</b> words_alphabetical.c:121</div></div> <div class="ttc" id="awords__alphabetical_8c_html_af1f9b6eb320d872ba0766dc8bd070075"><div class="ttname"><a href="../../d3/d78/words__alphabetical_8c.html#af1f9b6eb320d872ba0766dc8bd070075">closeFile</a></div><div class="ttdeci">void closeFile(FILE *file)</div><div class="ttdoc">Closes the file after reading or writing.</div><div class="ttdef"><b>Definition:</b> words_alphabetical.c:90</div></div> </div><!-- fragment --><div class="dynheader"> Here is the call graph for this function:</div> <div class="dyncontent"> <div class="center"><div class="zoom"><iframe scrolling="no" frameborder="0" src="../../d3/d78/words__alphabetical_8c_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg" width="100%" height="475"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div> </div> </div> </div> </div> <a id="a22516c70583c9fa78e4edffb063836cc" name="a22516c70583c9fa78e4edffb063836cc"></a> <h2 class="memtitle"><span class="permalink"><a href="#a22516c70583c9fa78e4edffb063836cc">◆ </a></span>writeContentOfTreeToFile()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void writeContentOfTreeToFile </td> <td>(</td> <td class="paramtype">struct <a class="el" href="../../db/d8b/struct_node.html">Node</a> * </td> <td class="paramname"><em>node</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">FILE * </td> <td class="paramname"><em>file</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Writes contents of tree to another file alphabetically. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">node</td><td>pointer to current node </td></tr> <tr><td class="paramname">file</td><td>pointer to file </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>void </dd></dl> <p >< for word numbering in the write file</p> <div class="fragment"><div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span>{</div> <div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span> <span class="keyword">static</span> uint64_t i = 1; <span class="comment">///< for word numbering in the write file</span></div> <div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span> <span class="keywordflow">if</span> (<a class="code hl_struct" href="../../d5/da1/structnode.html">node</a> != NULL) <span class="comment">// checks if the node is valid</span></div> <div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> {</div> <div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span> <a class="code hl_function" href="../../d3/d78/words__alphabetical_8c.html#a22516c70583c9fa78e4edffb063836cc">writeContentOfTreeToFile</a>(</div> <div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span> <a class="code hl_struct" href="../../d5/da1/structnode.html">node</a>-><a class="code hl_variable" href="../../d5/da1/structnode.html#af7109e6ffd82cbbb705e486fd0ce92f0">left</a>,</div> <div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span> file); <span class="comment">// calls `writeContentOfTreeToFile` for left sub tree</span></div> <div class="line"><a id="l00129" name="l00129"></a><span class="lineno"> 129</span> fprintf(file, <span class="stringliteral">"%-5lu \t %-9lu \t %s \n"</span>, i++, <a class="code hl_struct" href="../../d5/da1/structnode.html">node</a>->frequency,</div> <div class="line"><a id="l00130" name="l00130"></a><span class="lineno"> 130</span> <a class="code hl_struct" href="../../d5/da1/structnode.html">node</a>->word); <span class="comment">// prints the word number, word frequency and word</span></div> <div class="line"><a id="l00131" name="l00131"></a><span class="lineno"> 131</span> <span class="comment">// in tabular format to the file</span></div> <div class="line"><a id="l00132" name="l00132"></a><span class="lineno"> 132</span> <a class="code hl_function" href="../../d3/d78/words__alphabetical_8c.html#a22516c70583c9fa78e4edffb063836cc">writeContentOfTreeToFile</a>(</div> <div class="line"><a id="l00133" name="l00133"></a><span class="lineno"> 133</span> <a class="code hl_struct" href="../../d5/da1/structnode.html">node</a>-><a class="code hl_variable" href="../../d5/da1/structnode.html#a51e160f22dc6064bac4a4f9f1d931c2c">right</a>,</div> <div class="line"><a id="l00134" name="l00134"></a><span class="lineno"> 134</span> file); <span class="comment">// calls `writeContentOfTreeToFile` for right sub tree</span></div> <div class="line"><a id="l00135" name="l00135"></a><span class="lineno"> 135</span> }</div> <div class="line"><a id="l00136" name="l00136"></a><span class="lineno"> 136</span>}</div> </div><!-- fragment --><div class="dynheader"> Here is the call graph for this function:</div> <div class="dyncontent"> <div class="center"><iframe scrolling="no" frameborder="0" src="../../d3/d78/words__alphabetical_8c_a22516c70583c9fa78e4edffb063836cc_cgraph.svg" width="184" height="62"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe> </div> </div> </div> </div> </div><!-- contents --> </div><!-- doc-content --> <!-- start footer part --> <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> <ul> <li class="navelem"><a class="el" href="../../dir_2e746e9d06bf2d8ff842208bcc6ebcfc.html">data_structures</a></li><li class="navelem"><a class="el" href="../../dir_e39df94f82619fa5256f1786519937be.html">binary_trees</a></li><li class="navelem"><a class="el" href="../../d3/d78/words__alphabetical_8c.html">words_alphabetical.c</a></li> <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> </ul> </div> </body> </html>