strcpy in c

Solutions on MaxInterview for strcpy in c by the best coders in the world

showing results for - "strcpy in c"
Leonie
07 Sep 2016
1/* strcpy example */
2#include <stdio.h>
3#include <string.h>
4
5int main ()
6{
7  char str1[]="Sample string";
8  char str2[40];
9  char str3[40];
10  strcpy (str2,str1);//str1 copies to str2
11  strcpy (str3,"copy successful");
12  printf ("str1: %s\nstr2: %s\nstr3: %s\n",str1,str2,str3);
13  return 0;
14}
Margarita
24 Jul 2018
1#include <stdio.h>
2#include <stdlib.h>
3#include <string.h>
4 
5int main()
6{
7    char Temp[255];
8    strcpy(&Temp,"Gladir");
9    strcpy(&Temp,"ABC");
10    strcpy(&Temp,"Gladir.com");
11    puts(&Temp);
12    return 0;
13}
Linus
26 Mar 2017
1#include <stdio.h>
2#include <string.h>
3
4int main() {
5   char str1[20] = "C programming";
6   char str2[20];
7
8   // copying str1 to str2
9   strcpy(str2, str1);
10
11   puts(str2); // C programming
12
13   return 0;
14}
Arianna
03 Jan 2017
1char *strcpy(char *dest, const char *src)