简体   繁体   中英

Accessing allocated memory byte by byte allocated by malloc c++

C ++中有一种方法可以按字节访问动态分配的内存空间,而不管此内存的大小如何

Of course, you use a char -pointer for that, which is guaranteed to be able to address all contiguous bytes.

You shouldn't read out of allocated bounds, however, which could crash your program runtime or even the OS, depending on the OS.

Anyways: With a probability towards 1, this is not what you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM