- 4
- 0
- 约8.44万字
- 约 18页
- 2017-06-05 发布于河南
- 举报
字符串的概念(国外英文资料)
字符串的概念
The first part: the concept of a string
String: a string of characters caused by double quotation marks. In C language, the system will automatically add an end mark \ 0 to string, the end is not as the actual length of the string, but as the end mark occupies 1 byte in memory storage space.
For example: ABC
-there is no string type data in C. But in practice, a lot of strings are used.
The access to a string in C is achieved by relying on a one-dimensional character array.
For example: char STR [10] = { A , B, C, D, E, \, A, B}
- a character array that ends with \ 0 is considered a string.
Part 2: the storage of strings
Assign strings to an array of characters
For example: char STR [8] = { A , B, C, D}
Char STR [8] = { ABCD ;
-- char STR [] = ABCD ;
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * in the execution part, the character array cannot be directly assigned to the string:
Char STR [8].
STR = ABCD;
is done in part by assigning a string to a character array and finally adding an end to the human being.
For example: char STR [8];
STR [0] = A, STR [1] = B... STR [3] = D, STR [4] = \ 0;
Pay character Pointers to strings:
(1) a pointer to a string in the definition section:
Char * p = ABCD;
(2) it can also be performed in part to give a pointer to a string:
Char * p;
P = ABCD;
3. Distinguish between:
The type is assigned to a string array, the array to a string in memory opened a large enough space, and the string is assigned to a pointer, saying only that the pointer to a string, do not open up space for it.
Part 3: the input and output of a string
1. Call the scanf printf
- printf function:
* * the necessary condition for the output: the output item can be the array name, the pointer, the string itself
* * * USES the format character % s in the C language to implement the overall output of the string.
* * output until you run into the first \ 0 end of the o
您可能关注的文档
- 关心和支撑中间(国外英文资料).doc
- 具体讲解接口的定义(国外英文资料).doc
- 关键人物杜鹃(国外英文资料).doc
- 兼有js与java的正则用法(国外英文资料).doc
- 六年级语文复习归类资料(四)(国外英文资料).doc
- 六种方法轻松挽回破坏的Word数据(国外英文资料).doc
- 养老金并轨一锤定音:“提职一日游”将停止(国外英文资料).doc
- 内外妇儿(国外英文资料).doc
- 六级653分高手过四六级测验的规律,考前温习方法,不懂照样过(国外英文资料).doc
- 六年级上学期语文快乐周末短文分析(国外英文资料).doc
- 中国国家标准 GB/T 16172-2026建筑材料热释放速率和产烟速率试验方法.pdf
- GB/T 16172-2026建筑材料热释放速率和产烟速率试验方法.pdf
- 《GB/T 16172-2026建筑材料热释放速率和产烟速率试验方法》.pdf
- 《GB/T 14926.62-2026实验动物 猴免疫缺陷病毒检测方法》.pdf
- GB/T 14926.62-2026实验动物 猴免疫缺陷病毒检测方法.pdf
- GB/T 46917.3-2026标准语义知识库 第3部分:语义集成技术要求.pdf
- 《GB/T 46917.3-2026标准语义知识库 第3部分:语义集成技术要求》.pdf
- 中国国家标准 GB/T 46917.3-2026标准语义知识库 第3部分:语义集成技术要求.pdf
- 中国国家标准 GB/T 45305.3-2026声学 建筑构件隔声的实验室测量 第3部分:撞击声隔声测量.pdf
- GB/T 45305.3-2026声学 建筑构件隔声的实验室测量 第3部分:撞击声隔声测量.pdf
原创力文档

文档评论(0)