Hi all, I want to copy a string to a char array using strcpy function. I just want to ask whether the following is correct
Consider:
Or should i use:Code:char a[10]; strcpy(a,"Hello");
I have mostly seen the later approach being used, I want to know what is the harm in the first approach?Code:char *ptr,a[10]; ptr=a; strcpy(ptr,"Hello");
Any suggestions would be helpful!