Home>Article> What is the end of string flag?

What is the end of string flag?

hzc
hzc Original
2020-07-02 11:58:50 32814browse

The string end mark is "\0", and 0 is the ASCII code representation of "\0", which is the first ASCII code. The ASCII code of the number 0 is 48, so you need to use " /0" ends.

What is the end of string flag?

#'\0' is the end mark of the string array.

And 0 is the ASCII code representation of '\0', which is the first ASCII code. The ASCII code of the number 0 is 48, so when writing a program, you must end it with '\0', such as char a[3 ] = {'h','i','\0'}, or directly char a[] = "hi", the compiler will think it is a string array and ends with '\0'.

When debugging the program, you can see that there is 0 in the memory. This is the representation of the ASCII code and can also be regarded as anunsigned inttype.

Application reference of strings:

1. Concatenation operationconcat(s1,s2,s3…sn)is equivalent tos1 s2 s3…sn.

Example:concat('11','aa')='11aa';

2. Find the substring.Copy(s,I,I)Extract a substring of length l starting from the I-th character from the string s.

Example:copy(‘abdag’,2,3)=’bda’

3. Delete the substring. The procedure Delete(s,I,l) deletes the substring of length l starting from the I-th character from the string s.

Example:s:=’abcde’;delete(s,2,3);Results:=’ae’

The above is the detailed content of What is the end of string flag?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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