How to pass an array to a function that uses sizeof? : <p>This is what I use to get the length of an array:</p>

<pre><code>sizeof(counts) / sizeof(unsigned long)
</code></pre>

<p>Now I want to make a simple function out of it like:</p>

<pre><code>int length(unsigned long* input)
{
    return (sizeof(input) / sizeof(unsigned long));
}


unsigned long array[3];

sizeof(array) = 12
sizeof(unsigned long) = 4
sizeof(array) / sizeof(unsigned long) = 3

lenght(array) = 1
</code></pre>

<p>Inside length() sizeof(array) returns 4</p>

<p>The compiler will complain when I change the function to:</p>

<pre><code>int length(unsigned long input)
{
  return (sizeof(input) / sizeof(unsigned long));
}
</code></pre>

<p>I'm either stoned or just dumb, what am I doing wrong?</p>
