Let's say I have a function as follows:

```
void function(const char * str) {
    // initialize string
}

```

Is there considered a "standard" way or best practice to initialize a new string for a function? For example, what would be the difference in using the following approaches:

```
char * str1;

char * str2 = malloc(len);
char str3[len];

```

Is there a time when I should use one over the other? It seems like using `char * str2 = malloc(len);` would be the most flexible of the above.