Question: ```
#include <stdio.h>

struct Analysis {
    int lnlen;   
    int arr[2]; 
    char* name;
};

int main()
{
    struct Analysis ana_space[2];
    char *ptr = (void*) &ana_space;

    ana_space[0].lnlen = 0;
    ana_space[0].arr[0] = 1;
    ana_space[0].arr[1] = 2;
    ana_space[0].name = "Peter";

    printf("\n%d\n", *ptr);     // print 0;

    *ptr = 10;                  // how to use memcpy here;

    printf("\n%d\n", *ptr);     // print 10;

    ptr = ptr + sizeof(int);    // advance pointer by int;

    printf("\n%d\n", *ptr);     // print 1;  

    ptr = ptr + 2*sizeof(int);  // advance pointer by 2 ints;

    printf("\n%s\n", *ptr);     // print "Peter"; --------------not work

    //*ptr = "Jim";             // how to assign new name "Jim" into that memory;
    return 0;
}

```

Output:

> 
> 0
> 
> 
> 10
> 
> 
> 1
> 
> 
> (null)
> 
> 
> 

I want to use char \* as pointer to go through memory address to get some data and also store value into memory.

For int and int array, it works fine, but not for the string.

How to print the string and store new string value into memory?

Answer: 
`printf` expects a pointer for the `%s` format specifier. If you pass in `*p`, you are de-referenceing `p` and actually passing in the first byte of your string (e.g. 'P'). `printf` is then treating the that first 'P' of your string as a pointer, and it's leading it to an invalid memory location.

As a general rule, in C you don't usually pass strings by value. Instead you pass pointers to strings.
If you want to the print the value of the *address* of the `p` variable [vs. what it points to], use:

```
printf("%p\n",&p);

```

This will give you the address of `p` on the stack, which should be a fairly high memory address (e.g. `0x7ffdb4066268`).

If you want the address of the string constant pointed to by `p` [vs. the string], do:

```
printf("%p\n",p);

```

You'll get something like `0x400xxx`