What is the difference between pointer and array in the following context?

arrays, c++, pointers, strcpy

Solution

- pName[0] is the first element in a character array (one character)

- pName is a shortcut to &pName[0] (a pointer to the first element of your array)

The reason you are getting your error is because strcpy expects a pointer to a char (char*), and not a char value (which is what pName[0] is)

Problem

``` #include <cstring> int main() { char *pName = new char[10]; char dummy[] = "dummy"; strcpy(pName + 0,dummy);//how this is different from -->this works strcpy(pName[0],dummy);//this one...--> error C2664: 'strcpy' : //cannot convert parameter 1 //from 'char' to 'char *' } ```

Original source