一种使用编译器编译时确认字符串占用数组大小的方法

@2018-10-19

【方法】

巧妙利用0大小数组

char temp[0] = "This is test string!";

编译结果: error:  #144: a value of type "char [21]" cannot be used to initialize an entity of type "char [0]"

由此便可看出数组大小(包括'')

【环境】

KEIL 5.25

原文地址:https://www.cnblogs.com/skullboyer/p/9816031.html