当前位置:网站首页>Wild pointer understanding

Wild pointer understanding

2022-06-12 14:55:00 Leg hair Ger

The position of the pointer is unknown ( Random 、 incorrect 、 There is no definite limit to )

The cause of the wild pointer

1. Pointer not initialized

2 Pointer cross boundary access

The space that the pointer points to is released

 

  How to avoid wild pointer

1. Pointer initialization

2. Watch out for the pointer

3. Pointer to space release even if set to NULL

4. Avoid returning the address of a local variable

5. Check the validity of the pointer before using it

原网站

版权声明
本文为[Leg hair Ger]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/163/202206121442256806.html