Programming
Python
R
Java
C
C++
C#
WEB
HTML
CSS
JavaScript
BootStrap4
jQuery
SVG
MORE
Examples1
Python
GO
R
Java
C
C++
C#
Examples2
Python
R
Java
C
C++
C#
HTML
CSS
JavaScript
BootStrap4
jQuery
SVG
Seo Tools
Code Minifier
Code Beautifier
Language Compiler
Misc Tools
File Converter
References
C
C++
Python
Java
PHP
JavaScript
Examples
Python
R
Java
C
C++
C#
HTML
CSS
JavaScript
BootStrap4
jQuery
SVG
Home
About
Contact
JetPack
Multi Themes-->>
Code it ALL
Scroll TOP
strcpy() in C - CodeGK
Δ C Examples
Hello_world
"Hello World" program in C
Break
Break out of For Loop in C
Break out of While Loop in C
Strings
String Declaration in C ?
String Initialization in C ?
strlen() in C
strcpy() in C
strcat() in C
strcmp() in C
For_loop
Number Loop in C
Iterate Through String in C
Variables
Global Variable in C
Local Variable in C
Booleans
C Booleans
Arrays
Character Array in C
Integer Array in C
While_loop
While Loop in C
Recursive_function
Factorial with C Function Recursion
Sum of Natural Numbers with C function Recursion
Function
add Two numbers in C
Calculating factorial of number using Recursion in C
Print
puts() in C
printf() in C
printf() for printing various types of Data Types
Continue
Continue in For Loop in C
Continue in While Loop in C
If_else
IF in C
ELSE in C
Else-If in C
Numbers
Integers in C
Float in C
Double in C
Syntax
Right Syntax in C
Wrong Syntax in C
Operators
Comparison Operators in C
Arithematic Operators in C
Assignment Operators in C
Logical Operators in C
Constants
Constants in C
Violating-Constants in C
Structures
Initializing a Structure in C
Assignment of Structure in C
♦ strcpy() in C
♣ Example4: strcpy() in C
strcpy()
is a in-built C method(function) to copy a string to another string.
In this example, the program will copy string str1 into str2.
Example
Input:
Run CODE
Reload Code
Copy Code
#include
#include
int main() { char str1[]="cake"; char str2[30]; strcpy(str2, str1); puts(str2); return 0; }
Output:
Strings
strcpy() in C