*** Welcome to piglix ***

Strcpy


The C programming language has a set of functions implementing operations on strings (character strings and byte strings) in its standard library. Various operations, such as copying, concatenation, tokenization and searching are supported. For character strings, the standard library uses the convention that strings are null-terminated: a string of n characters is represented as an array of n + 1 elements, the last of which is a "NUL" character.

The only support for strings in the programming language proper is that the compiler translates quoted string constants into null-terminated strings.

A string is a contiguous sequence of code units terminated by the first zero code (\0, corresponding to the null character). In C, there are two types of strings: string, which is sometimes called byte string which uses the type chars as code units (one char is at least 8 bits), and wide string which uses the type wchar_t as code units.

A common misconception is that all char arrays are strings, because string literals are converted to arrays during the compilation (or translation) phase. It is important to remember that a string ends at the first zero code unit. An array or string literal that contains a zero before the last byte therefore contains a string, or possibly several strings, but is not itself a string. Conversely, it is possible to create a char array that is not null-terminated and is thus not a string: char is often used as a small integer when needing to save memory.

The term pointer to a string is used in C to describe a pointer to the initial (lowest-addressed) byte of a string. In C, pointers are used to pass strings to functions. Documentation (including this page) will often use the term string to mean pointer to a string.


...
Wikipedia

...