请教一个特菜的问题
const char * a1="a";
const char * a2="b";
char * a3;
如何将a1和a2值相加赋给a3
最后a3的值为ab
谢谢:)
#include <string.h>
const char * a1="a";
const char * a2="b";
char * a3= new char[strlen(a1)+strlen(a2)+1];
strcpy(a3,a1);
strcat(a3,a2);
为什么还那么多的警告呢??
如下:
e:\备份程序库\studio\infoengine\infoengine\infoengine.cpp(153) : warning C4996: 'strcpy' was declared deprecated
d:\microsoft visual studio\vc\include\string.h(73) : see declaration of 'strcpy'
Message: 'This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
e:\备份程序库\studio\infoengine\infoengine\infoengine.cpp(154) : warning C4996: 'strcat' was declared deprecated
d:\microsoft visual studio\vc\include\string.h(78) : see declaration of 'strcat'
Message: 'This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
谢谢:)