C Copy String Strcpy - C Programming Tutorial
C Course / Miscellaneous / C Copy String Strcpy

C Copy String Strcpy

BLUF: Understanding C Copy String Strcpy is a foundational part of learning C programming. This tutorial explains the core principles and syntax needed to implement this concept effectively.
Core Programming Principle: C Copy String Strcpy

C provides direct access to memory and system resources. Learn how C Copy String Strcpy leverages this power in the lesson below.

Example

#include<stdio.h>

#include <string.h>  

int main(){  

 char ch[20]={'t', 'p', 'o', 'i', 'n', 't', 't', 'e', 'c', 'h', '\0'};   

   char ch2[20];  

   strcpy(ch2,ch);  

   printf("Value of second string is: %s",ch2);  

 return 0;  

}

Output:

Output

Value of second string is: logic practice

Input Required

This code uses input(). Please provide values below:

Logic Practice
Install Logic Practice
Add to home screen for a faster app-like experience