warning:deprecated conversion from string constant to 'char *' 解决方式 #include <iostream> using namespace std; int fuc(char *a) { cout << a << endl; } int main() { fuc("hello"); } Linux 环境下当GCC版本号比較高时,编译代码可能出现的问题. 主要原因是: char * 指…
#include <iostream> using namespace std; int fuc(char *a) { cout << a << endl; } int main() { fuc("hello"); } Linux 环境下当GCC版本比较高时,编译代码可能出现的问题 问题是这样产生的,先看这个函数原型: void someFunc(char *someStr); 再看这个函数调用: someFunc("I'm a strin…
deprecated conversion from string constant to ‘char*’ #include <iostream> using namespace std; int fuc(char *a) { cout << a << endl; } int main() { fuc("hello"); } Linux 环境下当GCC版本比较高时,编译代码可能出现的问题 问题是这样产生的,先看这个函数原型: 1 void someF…
在C++中, char* p = "abc"; // valid in C, invalid in C++ 会跳出警告:warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] 改成下面会通过warning char* p = (char*)"abc"; // OK 或者改成下面: char const *p = "abc"; // OK…
/work/platform_bus_dev_drv/led_dev.c:52: error: expected declaration specifiers or '...' before string constant /work/platform_bus_dev_drv/led_dev.c:52: warning: data definition has no type or storage class /work/platform_bus_dev_drv/led_dev.c:52: wa…
Question: The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "…