⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 arraylist_8h.html

📁 常用的数据结构和算法函数库
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>C Algorithms: arraylist.h File Reference</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.4.4 --><div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div><h1>arraylist.h File Reference</h1>Automatically resizing array. <a href="#_details">More...</a><p><table border="0" cellpadding="0" cellspacing="0"><tr><td></td></tr><tr><td colspan="2"><br><h2>Data Structures</h2></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">struct &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct__ArrayList.html">_ArrayList</a></td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">An ArrayList structure.  <a href="struct__ArrayList.html#_details">More...</a><br></td></tr><tr><td colspan="2"><br><h2>Typedefs</h2></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">typedef <a class="el" href="struct__ArrayList.html">_ArrayList</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="arraylist_8h.html#a0">ArrayList</a></td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">An ArrayList structure.  <a href="#a0"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">typedef int(*&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="arraylist_8h.html#a1">ArrayListEqualFunc</a> )(void *data1, void *data2)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Compare two values in an arraylist to determine if they are equal.  <a href="#a1"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">typedef int(*&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="arraylist_8h.html#a2">ArrayListCompareFunc</a> )(void *data1, void *data2)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Compare two values in an arraylist.  <a href="#a2"></a><br></td></tr><tr><td colspan="2"><br><h2>Functions</h2></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="struct__ArrayList.html">ArrayList</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="arraylist_8h.html#a3">arraylist_new</a> (int length)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Allocate a new ArrayList for use.  <a href="#a3"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="arraylist_8h.html#a4">arraylist_free</a> (<a class="el" href="struct__ArrayList.html">ArrayList</a> *arraylist)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Destroy an ArrayList and free back the memory it uses.  <a href="#a4"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="arraylist_8h.html#a5">arraylist_append</a> (<a class="el" href="struct__ArrayList.html">ArrayList</a> *arraylist, void *data)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Append data to the end of an ArrayList.  <a href="#a5"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="arraylist_8h.html#a6">arraylist_prepend</a> (<a class="el" href="struct__ArrayList.html">ArrayList</a> *arraylist, void *data)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Prepend data to the beginning of an ArrayList.  <a href="#a6"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="arraylist_8h.html#a7">arraylist_remove</a> (<a class="el" href="struct__ArrayList.html">ArrayList</a> *arraylist, int index)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Remove the entry at the specified location in an ArrayList.  <a href="#a7"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="arraylist_8h.html#a8">arraylist_remove_range</a> (<a class="el" href="struct__ArrayList.html">ArrayList</a> *arraylist, int index, int length)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Remove a range of entries at the specified location in an ArrayList.  <a href="#a8"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="arraylist_8h.html#a9">arraylist_insert</a> (<a class="el" href="struct__ArrayList.html">ArrayList</a> *arraylist, int index, void *data)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Insert new data at the specified index in an ArrayList.  <a href="#a9"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="arraylist_8h.html#a10">arraylist_index_of</a> (<a class="el" href="struct__ArrayList.html">ArrayList</a> *arraylist, <a class="el" href="arraylist_8h.html#a1">ArrayListEqualFunc</a> callback, void *data)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Find the index of a particular pointer in an ArrayList.  <a href="#a10"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="arraylist_8h.html#a11">arraylist_clear</a> (<a class="el" href="struct__ArrayList.html">ArrayList</a> *arraylist)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Remove all entries from an ArrayList.  <a href="#a11"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="arraylist_8h.html#a12">arraylist_sort</a> (<a class="el" href="struct__ArrayList.html">ArrayList</a> *arraylist, <a class="el" href="arraylist_8h.html#a2">ArrayListCompareFunc</a> compare_func)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sort the values in an ArrayList.  <a href="#a12"></a><br></td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2>Automatically resizing array. <p>ArrayLists are arrays of pointers which automatically increase in size.<p>To create an ArrayList, use <a class="el" href="arraylist_8h.html#a3">arraylist_new</a>. To destroy an ArrayList, use <a class="el" href="arraylist_8h.html#a4">arraylist_free</a>.<p>To add data an ArrayList, use <a class="el" href="arraylist_8h.html#a6">arraylist_prepend</a>, <a class="el" href="arraylist_8h.html#a5">arraylist_append</a>, or <a class="el" href="arraylist_8h.html#a9">arraylist_insert</a>.<p>To remove data from an ArrayList, use <a class="el" href="arraylist_8h.html#a7">arraylist_remove</a> or <a class="el" href="arraylist_8h.html#a8">arraylist_remove_range</a>.<hr><h2>Typedef Documentation</h2><a class="anchor" name="a0"></a><!-- doxytag: member="arraylist.h::ArrayList" ref="a0" args="" --><p><table class="mdTable" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top">typedef struct <a class="el" href="struct__ArrayList.html">_ArrayList</a>  <a class="el" href="struct__ArrayList.html">ArrayList</a>          </td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>An ArrayList structure. <p>New ArrayLists can be created using the arraylist_new function.<p><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="arraylist_8h.html#a3">arraylist_new</a></dd></dl>    </td>  </tr></table><a class="anchor" name="a2"></a><!-- doxytag: member="arraylist.h::ArrayListCompareFunc" ref="a2" args=")(void *data1, void *data2)" --><p><table class="mdTable" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top">typedef int(* <a class="el" href="arraylist_8h.html#a2">ArrayListCompareFunc</a>)(void *data1, void *data2)          </td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>Compare two values in an arraylist. <p>Used by <a class="el" href="arraylist_8h.html#a12">arraylist_sort</a> when sorting values.<p><dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td valign="top"></td><td valign="top"><em>data1</em>&nbsp;</td><td>The first value. </td></tr>    <tr><td valign="top"></td><td valign="top"><em>data2</em>&nbsp;</td><td>The second value. </td></tr>  </table></dl><dl compact><dt><b>Returns:</b></dt><dd>A negative number if data1 should be sorted before data2, a positive number if data2 should be sorted before data1, zero if the two values are equal.</dd></dl>    </td>  </tr></table><a class="anchor" name="a1"></a><!-- doxytag: member="arraylist.h::ArrayListEqualFunc" ref="a1" args=")(void *data1, void *data2)" --><p><table class="mdTable" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top">typedef int(* <a class="el" href="arraylist_8h.html#a1">ArrayListEqualFunc</a>)(void *data1, void *data2)          </td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>Compare two values in an arraylist to determine if they are equal. <p><dl compact><dt><b>Returns:</b></dt><dd>Non-zero if the values are not equal, zero if they are equal.</dd></dl>    </td>  </tr></table><hr><h2>Function Documentation</h2><a class="anchor" name="a5"></a><!-- doxytag: member="arraylist.h::arraylist_append" ref="a5" args="(ArrayList *arraylist, void *data)" --><p><table class="mdTable" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top">void arraylist_append           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top"><a class="el" href="struct__ArrayList.html">ArrayList</a> *&nbsp;</td>          <td class="mdname" nowrap> <em>arraylist</em>, </td>        </tr>        <tr>          <td class="md" nowrap align="right"></td>          <td class="md"></td>          <td class="md" nowrap>void *&nbsp;</td>          <td class="mdname" nowrap> <em>data</em></td>        </tr>        <tr>          <td class="md"></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"></td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>Append data to the end of an ArrayList. <p><dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td valign="top"></td><td valign="top"><em>arraylist</em>&nbsp;</td><td>The ArrayList. </td></tr>    <tr><td valign="top"></td><td valign="top"><em>data</em>&nbsp;</td><td>The data to append.</td></tr>  </table></dl>    </td>  </tr></table><a class="anchor" name="a11"></a><!-- doxytag: member="arraylist.h::arraylist_clear" ref="a11" args="(ArrayList *arraylist)" --><p><table class="mdTable" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top">void arraylist_clear           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top"><a class="el" href="struct__ArrayList.html">ArrayList</a> *&nbsp;</td>          <td class="mdname1" valign="top" nowrap> <em>arraylist</em>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>Remove all entries from an ArrayList. <p><dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td valign="top"></td><td valign="top"><em>arraylist</em>&nbsp;</td><td>The ArrayList.</td></tr>  </table></dl>    </td>  </tr></table><a class="anchor" name="a4"></a><!-- doxytag: member="arraylist.h::arraylist_free" ref="a4" args="(ArrayList *arraylist)" --><p><table class="mdTable" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top">void arraylist_free           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top"><a class="el" href="struct__ArrayList.html">ArrayList</a> *&nbsp;</td>          <td class="mdname1" valign="top" nowrap> <em>arraylist</em>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>Destroy an ArrayList and free back the memory it uses. <p><dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td valign="top"></td><td valign="top"><em>arraylist</em>&nbsp;</td><td>The ArrayList to free.</td></tr>  </table></dl>    </td>  </tr></table><a class="anchor" name="a10"></a><!-- doxytag: member="arraylist.h::arraylist_index_of" ref="a10" args="(ArrayList *arraylist, ArrayListEqualFunc callback, void *data)" --><p><table class="mdTable" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top">int arraylist_index_of           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top"><a class="el" href="struct__ArrayList.html">ArrayList</a> *&nbsp;</td>          <td class="mdname" nowrap> <em>arraylist</em>, </td>        </tr>        <tr>          <td class="md" nowrap align="right"></td>          <td class="md"></td>          <td class="md" nowrap><a class="el" href="arraylist_8h.html#a1">ArrayListEqualFunc</a>&nbsp;</td>          <td class="mdname" nowrap> <em>callback</em>, </td>        </tr>        <tr>          <td class="md" nowrap align="right"></td>          <td class="md"></td>          <td class="md" nowrap>void *&nbsp;</td>          <td class="mdname" nowrap> <em>data</em></td>        </tr>        <tr>          <td class="md"></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"></td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -