zhedahht / CodingInterviewChinese2

《剑指Offer:名企面试官精讲典型编程面试题》第二版源代码
Other
5.32k stars 2.17k forks source link

Update ReplaceSpaces.cpp for array bounds #3

Open wylloong opened 7 years ago

wylloong commented 7 years ago

if((newLength+1) > length) return; 因为字符串末尾以'\0'结尾,所以newLength+1才是真实的字符数组长度。