在用vs2013编译时出现的问题,求解答
#include<stdio.h>
#include<string.h>
int main(int argc,char *argv[])
{
void swap(char *p1,char *p2);
char str1[31],str2[31],str3[31]; //数组的首元素有它的地址
printf("input three line:\n");
gets_s(str1);
gets_s(str2);
gets_s(str3);
if(strcmp(str1,str2)>0)swap(str1,str2);
if(strcmp(str1,str3)>0)swap(str1,str3);
if(strcmp(str2,str3)>0)swap(str2,str3);
printf("now,the order is:\n");
}
void swap(char *p1,char *p2)
{char p[31];
strcpy_s(p,p1);strcpy_s(p1,p2);strcpy_s(p2,p);
}
顺便解释下这些是怎么回事,谢谢
错误 1 error C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
2 IntelliSense: 没有与参数列表匹配的 重载函数 "strcpy_s" 实例
参数类型为: (char *, char *)
3 IntelliSense: 没有与参数列表匹配的 重载函数 "strcpy_s" 实例
参数类型为: (char *, char [31])