Showing posts with label C Copy String: strcpy(). Show all posts
Showing posts with label C Copy String: strcpy(). Show all posts

Thursday, July 5, 2018

C Copy String: strcpy()

The strcpy(destination, source) function copies the source string in destination.



#include<stdio.h>
#include <string.h>
int main(){
char ch[20]={'r', 'a', 'm', 'a','\0'};
char ch2[20];
strcpy(ch2,ch);
printf("Value of second string is: %s",ch2);
return 0;
}



Output:

Value of second string is: rama




Instagram