Home > Back-end >  The length of the string in the array
The length of the string in the array

Time:12-15

Why bosses, I define the length of the array is 10, but I run after input beyond the length of the string, it still can be stored and printed?

CodePudding user response:

Use for statement come, may cross a line and call you out

CodePudding user response:

Actually computer after each byte of physical memory has values and is read/write, never because of the so-called new, delete or malloc, free and is created and destroyed, the difference only lies in the operating system memory management module can find when you read and write and whether to take appropriate action, and the granularity of the operating system manages memory rather than bytes page, a page is usually 4 KB,

CodePudding user response:

An array is undefined behavior operation, undefined behavior may be no problem, do not recommend operating cross-border data,

CodePudding user response:

I generally described this way:
The equivalent of you stole a thing without being caught,
  • Related