Say we have the following function prototypes:
void function1(char str[]);
void function2(char *str);
Now say we have a string char name[] = "John";
that we wish to pass through these functions. What is the difference between the two? What are their uses and limitations? Are there circumstances in which one is preferred over the other? Would it make a difference if instead the string were initialized as char *name = "John"
?
I understand the difference between using char str[]
and char *str
within a function, but I don't know their behavior as function parameters or arguments.