1

When we write the prototype of strcpy() function it goes like this -

char *strcpy(char *s1, const char *s2);

here the second parameter const char*s2 which is to be copied to s1 is of constant type . Why we take it as a constant ?

  • The `const` keyword is being used for documentation. It's telling you that the `strcpy` function won't change the second string. – user3386109 Apr 25 '21 at 04:18
  • 1
    Does this answer your question? [Why strcpy takes const char\* for src instead of char \*?](https://stackoverflow.com/questions/35011815/why-strcpy-takes-const-char-for-src-instead-of-char) – Nicholas Hunter Apr 25 '21 at 04:19

0 Answers0