Question: Here is my program : 

```
#include <cstring>
const int SIZE =10; 

int main() 
{ 
    char aName [SIZE]; // creates an array on the stack
    std::strcpy(aName, "Mary");
    return 0;
}

```

This program is obviously useless, I am just trying to understand the behavior of the strcpy function.

Here is it's signature : 
`char * strcpy ( char * destination, const char * source )`

so when I do :
`std::strcpy(aName, "Mary");`

I am passing by value the variable aName. I know that the aName (in the main) contains the address of the array. 
So is this assertion correct : strcpy creates a local variable called destination that has as value the address of the array aName that I have created on the stack in the main function?

I am asking this because it is very confusing to me. Whenever I have encountered addresses it usually was to point to a memory allocated on the **heap**...

Thanks!

Answer: 
> 
> So is this assertion correct : strcpy creates a local variable called destination that has as value the address of the array aName that I have created on the stack in the main function?
> 
> 
> 

Yes.

> 
> Whenever I have encountered addresses it usually was to point to a memory allocated on the heap...
> 
> 
> 

Yep, usually. But not always.

Pointers to non-dynamically-allocated things are fairly rare in C++, though in C it's more common as that's the only way to have "out arguments" (C does not have references).

`strcpy` is a function from C's standard library.
Function parameters are its local variables.

In this call

```
std::strcpy(aName, "Mary");

```

the two arrays (one that is created in main with the automatic storage duration and other is the string literal that has the static storage duration) are implicitly converted to pointers to their first elements. 

So you may imagine this call and the function definition the following way

```
std::strcpy(aName, "Mary");

 // …

char * strcpy ( /* char * destination, const char * source */ )
{
    char *destination = aName;
    const char *source = "Mary";

    // …

    return destination;
}

```

Or even like

```
char *p_to_aName = &aName[0];
const char *p_to_literal = &"Mary"[0];
std::strcpy( p_to_aName, p_to_literal );

 // …

char * strcpy ( /* char * destination, const char * source */ )
{
    char *destination = p_to_aName;
    const char *source = p_to_literal;

    // …

    return destination;
}

```

That is within the function its parameters are local variable of pointer types with the automatic storage duration that are initialized by pointers to first characters of the passed character arrays