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.
Maybe it would help to look at an example implementation of `strcpy()`:

```
char* strcpy(char* d, const char* s)
{
    char* tmp = d;

    while (*tmp++ = *s++)
        ;

    return d;
}

```

That's really all there is to it. Copy characters from the source to the destination until the source character is null (including the null). Return the pointer to the beginning of the destination. Done.

Pointers point to memory. It doesn't matter if that memory is "stack", "heap" or "static".