Question: Suppose I have function 

> 
> foo(double \* pa)
> 
> 
> 

where `pa` is either populated from [0] to [100] 
OR 
`pa` is populated for [0] only.

My function does the following:

> 
> foo(double \* pa)
> 
> 
> {
> 
> 
> IF (pa is an array of 100) THEN x[0 to 100] = pa[0 to 100]
> 
> 
> ELSE x[0 to 100] = pa[0]
> 
> 
> }
> 
> 
>

Answer: 
Q: How is foo() going to know whether pa[] is an array of 100?

In general, you have to TELL it. For example:

```
void
foo (double *pa, int len)
{
  if (len == 100)
    ...
  else
    ...

```

If you were coding in C++, however, you could use an STL container such as a vector:

```
void foo (vector<double> & pa)
{
  if (pa.size() == 100)
    ...

```
You can't. The only thing `foo()` knows `pa` is that it's a pointer, whether it's a null pointer or not, and if it's non-null, what it points to. It can't tell whether it points to a single object or to the first element of an array.

If possible, you should probably `foo()` so the caller has to pass in additional information:

```
void foo(double *pa, size_t count) {
    /* ... */
}

```

(Note: you should declare `foo`'s return type.)