<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://www.lptms.universite-paris-saclay.fr//wiki/index.php?action=history&amp;feed=atom&amp;title=Passing_table_to_a_function</id>
	<title>Passing table to a function - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://www.lptms.universite-paris-saclay.fr//wiki/index.php?action=history&amp;feed=atom&amp;title=Passing_table_to_a_function"/>
	<link rel="alternate" type="text/html" href="http://www.lptms.universite-paris-saclay.fr//wiki/index.php?title=Passing_table_to_a_function&amp;action=history"/>
	<updated>2026-04-21T17:44:20Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>http://www.lptms.universite-paris-saclay.fr//wiki/index.php?title=Passing_table_to_a_function&amp;diff=384&amp;oldid=prev</id>
		<title>Roux: Created page with &quot;Passing a table to a function either via table type argument or by pointer.  &lt;source lang=&quot;c&quot;&gt; /* gcc -std=c99 code.c */  #include &quot;stdio.h&quot; #include &quot;stdlib.h&quot;  void function...&quot;</title>
		<link rel="alternate" type="text/html" href="http://www.lptms.universite-paris-saclay.fr//wiki/index.php?title=Passing_table_to_a_function&amp;diff=384&amp;oldid=prev"/>
		<updated>2012-11-26T21:27:44Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Passing a table to a function either via table type argument or by pointer.  &amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt; &lt;span class=&quot;autocomment&quot;&gt;gcc -std=c99 code.c: &lt;/span&gt;  #include &amp;quot;stdio.h&amp;quot; #include &amp;quot;stdlib.h&amp;quot;  void function...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Passing a table to a function either via table type argument or by pointer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/* gcc -std=c99 code.c */&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;stdio.h&amp;quot;&lt;br /&gt;
#include &amp;quot;stdlib.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
void function(int n, int tab[])&lt;br /&gt;
{&lt;br /&gt;
  for(int i=0;i&amp;lt;n;i++) tab[i] = i*i;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void function_ptr(int n, int * p)&lt;br /&gt;
{&lt;br /&gt;
  for(int i=0;i&amp;lt;n;i++) *(p+i) = 2*i-1;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char* argv[])&lt;br /&gt;
{&lt;br /&gt;
  if(argc != 2)&lt;br /&gt;
    {&lt;br /&gt;
      printf(&amp;quot;\tUsage:\t&amp;quot;);&lt;br /&gt;
      printf(&amp;quot;%s&amp;quot;,argv[0]);&lt;br /&gt;
      printf(&amp;quot; &amp;lt;integer&amp;gt;\n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
  else&lt;br /&gt;
    {&lt;br /&gt;
      int n = atoi(argv[1]);&lt;br /&gt;
      int t[n];&lt;br /&gt;
      printf(&amp;quot;Passing table\n&amp;quot;);&lt;br /&gt;
      function(n,t);&lt;br /&gt;
      for(int i=0;i&amp;lt;n;i++) printf(&amp;quot;%d &amp;quot;,t[i]);&lt;br /&gt;
      printf(&amp;quot;\nPassing pointer\n&amp;quot;);&lt;br /&gt;
      function_ptr(n,&amp;amp;t[0]);&lt;br /&gt;
      for(int i=0;i&amp;lt;n;i++) printf(&amp;quot;%d &amp;quot;,t[i]);&lt;br /&gt;
      printf(&amp;quot;\n&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
  return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Roux</name></author>
	</entry>
</feed>