strcpy function in c programming use to copy a sting from one variable to another variable. This article will help you to teach how to write the strcpy program in c programming.
How to Write strcpy Program In C
strcpy is an library function in c so you have to define <string.h> Library in header of c program and this function return copied value.
Syntax:-
char *strcpy(char *val1, const char *val2);
strcpy program in c programming
#include<stdio.h> #include <string.h> //string library int main() { char val1[20] = "strcpy C program"; char val2[20]; // copying str1 to str2 strcpy(val2, val1); puts(str2); // Output( ) return 0; } strcpy C program
strcpy function can be used with ANSI/ISO 9899-1990 version.
0 comments:
Post a Comment