Answers for "strcpy library c++"

C++
2

strcpy() in c++

What is strcpy() function in C++?
  
It is a part of <cstring> header file in c++.
strcpy() is a standard library function in C/C++ and is used to copy one string
to another. In C it is present in string. h header file and in C++ it is
present in cstring header file.
Posted by: Guest on August-06-2021
13

strcpy

/* strcpy example */
#include <stdio.h>
#include <string.h>

int main ()
{
  char str1[]="Sample string";
  char str2[40];
  char str3[40];
  strcpy (str2,str1);//str1 copies to str2
  strcpy (str3,"copy successful");
  printf ("str1: %snstr2: %snstr3: %sn",str1,str2,str3);
  return 0;
}
Posted by: Guest on March-05-2020

Browse Popular Code Answers by Language