用if测试函数返回值。
程序代码:#include <stdio.h>
#define _STDC_LIB_EXT1_ 1
#include <string.h>
int main (void)
{
#if defined _STDC_LIB_EXT1_
printf("OK!!\n");
#else
printf("NO!!\n");
#endif
char str1[50] = "To be, or not to be, ";
char str2[] = "that is the question.";
int retval = strcat_s(str1, sizeof(str1), str2);
if(retval)
printf("There was an error joining the strings. Error code = %d\n", retval);
else
printf("The combined strings:\n%s\n", str1);
return 0;
}
语句:int retval = strcat_s(str1, sizeof(str1), str2);是将strcat_s()函数的返回值给 retval吗?然后用if判断。




