Q:

C - Assigning a char* to a char array

I have a function that has an argument 'char *argument', like:
function(char *x) { ... }

When I call this function, I pass a char array as the argument
function(char_array);

In the function, I want to iterate the elements of the array char by char, so my thought was creating an array in the function and to it assign the argument of the function (i.e., char *x) so I'm able to iterate the elements of the array one by one, however, I don't seem to be able to do this assignment and I get an error that says:
incompatible types when assigning to type ‘char[8000]’ from type ‘char *’

So the question is: How do I assign a char pointer to a char array?

A:

You can't. But what you can do is iterate x directly as pointers can be used like arrays just as arrays can be converted to pointers. E.g.
function(char *x)
{
    for(int i = 0; i < 100; i++)
        printf("%d ", x[i]);
}

