strcpy() function in C | Detail

strcpy( ) function is basically used  in C program, to copy a string character from one string to another string.

strcpy function in c
strcpy( ) in C

In this article we will learn about string function, strcpy( ) in detail in which we will discuss following topics...
  1. strcpy function in c
  2. strcpy function in c example
  3. strcpy function in c syntax
  4. header file for strcpy function in c

strcpy( ) function in C

strcpy( ) function is also known as a built in function or standard library function of C but it widely know as string function. strcpy( ) function is basically used to copy one string to another string it works almost like a string assignment operator and assign contents of string2 to string1 where string may be character array variable or string constent.

Header file for strcpy( ) function in C

strcat( ) function is a built in function of C and it is define in <string.h> header file.

strcpy( ) function in C syntax

strcpy( str1 , str2);

Note: if you want to copy string2 in string1 than string1 is in left side and string2 is in right side in bracket but if you want to copy string1 in string2 than put the string2 in left side and string1 is in right side.

strcpy( ) function in C example

#include<stdio.h>
#include<string.h>
int main()
{
  char str[15]="Akash";
  char str1[7];
  strcpy(str1,str);
  printf("%s",str);
return 0;
}

____________________________________

strcpy() function in C | Detail
____________________________________

Conclusion:

"strcpy( ) function is basically used  in C program, to copy a string character from one string to another string."

Post a Comment (0)
Previous Post Next Post