I used strcpy_s
as below:
char names[2][20];
strcpy_s(names[0],"Michael");
strcpy_s(names[1],"Danny");
and it worked all right.
But when I changed to char **
,
int size1=2;
int size2=20;
char **names=new char*[size1];
for(int i=0;i<size1;i++)
names[i]=new char[size2];
strcpy_s(names[0],"Michael");
strcpy_s(names[1],"Danny");
It gives me this error message:
error C2660: 'strcpy_s' : function does not take 2 arguments
Why is this happening? I need to dynamically create char arrays, so what should I do?