Excuse me, the last element of an array of c language can't assignment
CodePudding user response:
You understand the last element of which is to point to?
Array a [5], for example, the last element is a [4] no problem, can the assignment, but a [5] have a problem, an array, the array subscript is from 0 to 4 a total of five elements
CodePudding user response:
refer to the original poster m0_46244162 response: could you please tell me the last element of an array of c language can't assign it It depends on your integer array you can literally assignment For character array, you can also see it as a string, the string at the end there is a \ 0 represents the end of the String or character array usually use Pointers to operate it operated by pointer string has a important conditions: according to whether it is at the end of \ 0 to judge whether a pointer to the string end If you put the last element of an array of characters assignment that you use the string pointer manipulation is vulnerable to an array of topics because you don't know at the end of the string CodePudding user response:
refer to the second floor 5250 response: Quote: refer to the original poster m0_46244162 response: could you please tell me the last element of an array of c language can't assign it It depends on your integer array you can literally assignment For character array, you can also see it as a string, the string at the end there is a \ 0 represents the end of the String or character array usually use Pointers to operate it operated by pointer string has a important conditions: according to whether it is at the end of \ 0 to judge whether a pointer to the string end If you put the last element of an array of characters assignment that you use the string pointer manipulation is vulnerable to an array of topics because you don't know at the end of the string no Can literally assignment? How can an error said damaged stack CodePudding user response:
reference 1st floor qybao response: you understand the last element of which is to point to? Array a [5], for example, the last element is a [4] no problem, can the assignment, but a [5] have a problem, an array, the array subscript is from 0 to 4 a total of five elements Bosses, this will have any exceptions such as an array of strings can not be an integer array can have this kind of situation?? CodePudding user response:
reference 1st floor qybao response: you understand the last element of which is to point to? Array a [5], for example, the last element is a [4] no problem, can the assignment, but a [5] have a problem, an array, the array subscript is from 0 to 4 a total of five elements Who do this will have any exceptions such as an array of strings can not but integer array can, for example, the said downstairs CodePudding user response:
As long as it is within the array, can be assigned, suggest the original poster posted code, if there is an error, is likely to be caused by crossing the line, on the stack is not recommended to define large arrays CodePudding user response:
reference 5 floor m0_46244162 reply: Quote: refer to 1st floor qybao response: you understand the last element of which is to point to? Array a [5], for example, the last element is a [4] no problem, can the assignment, but a [5] have a problem, an array, the array subscript is from 0 to 4 a total of five elements Who do this will have any exceptions such as an array of strings can not but integer array can for example below this answered Without exception, the end of the string the last character is also of its own guarantee, you do not set, it's not over yet,