malloc()和free()是如何工作的?
mallocfree
int main() {
unsigned char *p = (unsigned char*)malloc(4*sizeof(unsigned char));
memset(p,0,4);
strcpy((char*)p,"abcdabcd"); // **deliberately storing 8bytes**
cout << p;
free(p); // Obvious Crash, but I need how it works and why crash.
cout << p;
return 0;}
慕尼黑5688855
噜噜哒
墨色风雨
随时随地看视频慕课网APP
相关分类