这是我在知乎回答的一个问题. 这个问题是C中的一个深坑,首先说结论: char ** 和 const char ** 是两个不相容(incompatible)的类型,能够理解为不能直接赋值 在C11的6.5.2.2 Function calls中有例如以下内容 Each argument shall have a type such that its value may be assigned to an object with the unqualified version of the ty
环境:codeblocks 语言:C++ 在执行:throw new exception("queue is empty.");时 遇到问题:error: no matching function for call to 'std::exception:exception(const char[16])' 解决办法:修改为 std::logic_error e("xxx."); throw std::exception(e);
1.字符串 字符串本质就是一串字符,在C++中大家想到字符串往往第一反应是std::string(后面简称string) 字符串得从C语言说起,string其实是个类,C语言是没有class的,所以C语言的字符串其实就是字符数组,也就是char [ ] ,例如: char str[10]; //定义了一个有十个元素的数组,元素类型为字符char char str[10] = {"hello"}; //"h e l l o \0"五个字符赋给str数组, 然