字符串的概念(国外英文资料).docVIP

  • 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

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档