【发布时间】:2020-01-14 19:47:38
【问题描述】:
为什么 SIZE_OF_STR 为“hello”字符串返回 7 和 5 值?
#include <stdio.h>
#define SIZE_OF_STR(s) sizeof(s)/sizeof(char)-1
int main()
{
char *x = "hello";
printf("%d\n",SIZE_OF_STR(x));
printf("%d",SIZE_OF_STR("hello"));
return 0;
}
输出:
7
5
【问题讨论】: