Should I cast arrays to pointers when passing them to variadic functions like printf?
c, c++, printf
Solution
Yes, you can pass an array directly. Exactly, name of array represents address of the array which makes no difference with `char *`.
Problem
Can I pass an array to printf directly: ``` char text[1024] = "text"; printf("%s", text); ``` Or should I explicitly cast it to a char pointer: ``` char text[1024] = "text"; printf("%s", (char*) text); ``` I'm asking because I thought maybe it copies the array elements directly into the va_list instead of putting just a pointer to the first element.