求:当函数的缺省参数为字符串型正确的写法,该怎么处理
求:当函数的缺省参数为字符串型正确的写法
int cfg_fun_parameter(char cmd_str_in[]="$CFGSYS");
系统会给出警告提示,不建议这么给字符串赋值。但不影响运行。( 用g++ 命令行编译的)
warning: conversion from string literal to 'char *' is deprecated.
------解决思路----------------------
警告没事,只要你功能实现了
int cfg_fun_parameter(char cmd_str_in[]="$CFGSYS");
系统会给出警告提示,不建议这么给字符串赋值。但不影响运行。( 用g++ 命令行编译的)
warning: conversion from string literal to 'char *' is deprecated.
------解决思路----------------------
警告没事,只要你功能实现了