#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 *'
}
#include <cstring> int main() { char *pName = new char[10]; char dummy[] = dummy;
Share
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)