摘要: 译自stackoverflow,一个很有意思的问题。问题:string str = "abcdefgdcb";cout < < sizeof(str.substr(0,3).c_str());For some reason, the above string is giving me 8. I assumed c_str() returns a null string,由于某些原因,上面的这个字符串得到的结果是8,我估计c_str()返回了一个null,and sizeof uses the null to determine the size of the s 阅读全文
posted @ 2012-05-21 11:15 lazycoding 阅读(1803) 评论(0) 推荐(0)