This worked in another language, but does not work in C ++ for some reason.
Some things change from language to language. In particular, in this case, you are faced with the fact that in C ++ pointers and arrays are hardly different from each other. This array is passed to the → operator as a pointer to a char, which is interpreted as a pointer to a string, so it does what it does with char buffers (to read to the limit of the width or end of the string, depending on what happens first). Your program should crash when this happens as you overflow your buffer.
zmccord
source share