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: 
That's not possible. `pa` isn't *populated*, because it is not an array. It is a pointer which, by convention, points to the first element of an array. But its type is simply `pointer to double`, and it has no information about whether it points to a single double, or an array of 1, 10, 100 or 1000 elements.

The "traditional" solution would be to pass two parameters, the pointer and the size of the array:

```
void foo(double* pa, size_t arraysize)
{
    if (arraysize == 100) {
        ...
    }
    else {
        ...
    }
}

```
Based on your [previous question](https://stackoverflow.com/questions/6969465/can-we-create-an-if-statement-that-determines-if-a-variable-has-been-declared-as), combined with this question, I think what you may want is simply an overload, see here:

```
void foo_impl(double * x)
{
    // common functionality here
}

void foo(double * pa)
{
    double x[100];
    std::copy(pa, pa + 100, x);
    foo_impl(x);
}

void foo(double pa)
{
    double x[100];
    std::fill(x,x+100,pa);
    foo_impl(x);
}

```

With this, you can call foo with a pointer, where it's assumed to be pointing to an array with at least 100 values. Or you can call it with a single value. Put the common functionality between the two functions in `foo_impl`, that way you're not duplicating code.