<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1042894" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1042894</link>
    <description></description>
    <language>en</language>
          <item>
    <title>I&#039;m no computer scientist,</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/head-exploding-passing-array-c#comment-1237728</link>
    <description> &lt;p&gt;I&#039;m no computer scientist, but I&#039;ve always handled it by looking for null in the defined size of the array as the signal to stop processing.  In pseudo code:&lt;/p&gt;
&lt;p&gt;If you&#039;re filling the array sequentially&lt;br /&gt;
While (array element not equal null) and (in bounds of defined size of array)&lt;br /&gt;
   do processing on element&lt;br /&gt;
   get next element&lt;br /&gt;
End-While&lt;/p&gt;
&lt;p&gt;Or not...&lt;br /&gt;
For all elements in the defined size of the array&lt;br /&gt;
   if element is not null&lt;br /&gt;
      do processing on element&lt;br /&gt;
   end-if&lt;br /&gt;
End-For&lt;/p&gt;
&lt;p&gt;Cheers,&lt;br /&gt;
Shaggy&lt;/p&gt;
 </description>
     <pubDate>Sun, 01 Feb 2009 02:39:43 +0000</pubDate>
 <dc:creator>Shaggy</dc:creator>
 <guid isPermaLink="false">comment 1237728 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>Sounds like a lot of work</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/head-exploding-passing-array-c#comment-1237695</link>
    <description> &lt;p&gt;Sounds like a lot of work just to get a the size of an array.&lt;/p&gt;
 </description>
     <pubDate>Fri, 30 Jan 2009 19:20:16 +0000</pubDate>
 <dc:creator>pr0gr4mm3r</dc:creator>
 <guid isPermaLink="false">comment 1237695 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>I either just pass the</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/head-exploding-passing-array-c#comment-1237682</link>
    <description> &lt;p&gt;I either just pass the length of the array along with the array or use a linked list.  Both have advantages and disadvantages.&lt;/p&gt;
 </description>
     <pubDate>Fri, 30 Jan 2009 15:27:01 +0000</pubDate>
 <dc:creator>Wellsie1116</dc:creator>
 <guid isPermaLink="false">comment 1237682 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>The problem is that sizeof</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/head-exploding-passing-array-c#comment-1237665</link>
    <description> &lt;blockquote&gt;&lt;p&gt;The problem is that sizeof is executed at compile time, not runtime.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;That&#039;s good to know. &lt;/p&gt;
&lt;p&gt;This array size &lt;em&gt;does&lt;/em&gt; change during run time. I&#039;ve searched a ton of forums, and it doesn&#039;t look like it can be done. I guess I&#039;ll have to pass in the array length to every function. Not a huge deal. I just thought there would be a better way.&lt;/p&gt;
 </description>
     <pubDate>Fri, 30 Jan 2009 05:24:00 +0000</pubDate>
 <dc:creator>teammatt3</dc:creator>
 <guid isPermaLink="false">comment 1237665 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>The problem is that sizeof</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/head-exploding-passing-array-c#comment-1237659</link>
    <description> &lt;p&gt;The problem is that sizeof is executed at compile time, not runtime.  What this means is that the compiler knows the size of the array in main, because it was declared in main.  But in your function, all it knows is that it has an array, but has no idea how large it is.  Because it does not know how many elements are in the array, it just treats it as a pointer and returns the size of the pointer (4 in your case, and 8 in my case (64-bit os)) resulting in the wrong length of 1 (or 2 in my case).&lt;/p&gt;
&lt;p&gt;If the size of the array will never change during runtime, why not just declare the size of the array as a preprocessor variable:&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;#define ARRAY_SIZE 10&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;then if you want to declare an array of ints:&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;int nums[ARRAY_SIZE];&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
 </description>
     <pubDate>Thu, 29 Jan 2009 22:08:00 +0000</pubDate>
 <dc:creator>Wellsie1116</dc:creator>
 <guid isPermaLink="false">comment 1237659 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
