Home > Backend Development > C#.Net Tutorial > How to write strcpy function in c language

How to write strcpy function in c language

藏色散人
Release: 2020-02-11 09:00:09
Original
8327 people have browsed it

How to write strcpy function in c language

How to write strcpy function in C language

1. Build a basic C language program framework, pay attention to adding # includeHeader file

How to write strcpy function in c language

2. Define two character arrays

How to write strcpy function in c language

##3. strcpy function prototype :

 char *strcpy(char *dest, const char *src);
Copy after login

strcpy copies the string starting from the src address and containing the '\0' terminator to the address space starting with dest. The return value type is char*. Here we do not accept the return value

How to write strcpy function in c language

4. In this way, the test string is copied to the table array, and finally the string of the table array is printed out through puts

How to write strcpy function in c language

5. Save and exit under Linux, compile through the gcc compiler,

Compilation instructions: gcc .c file name -o file name .out generated after compilation

For example: gcc strcpy.c -o strcpy.out

How to write strcpy function in c language

3. Execute the compiled executable file

Instructions:. /strcpy.out

Press Enter to see the copied string output

How to write strcpy function in c language

How to write strcpy function in c language

Recommended learning:

c language video tutorial

The above is the detailed content of How to write strcpy function in c language. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template