Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

copy string c

// C program to illustrate
// strcpy() function ic C/C++
#include<stdio.h>
#include<string.h>
 
int main ()
{
    char str1[]="Hello Geeks!";
    char str2[] = "GeeksforGeeks";
    char str3[40];
    char str4[40];
    char str5[] = "GfG";
     
    strcpy(str2, str1);
    strcpy(str3, "Copy successful");
    strcpy(str4, str5);
    printf ("str1: %s
str2: %s
str3: %s
str4:
                  %s
", str1, str2, str3, str4);
    return 0;
}
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #copy #string
ADD COMMENT
Topic
Name
1+4 =