h**o 发帖数: 548 | 1 const char *MetricsTitleStr[] =
{
"Total_1",
"Total_2",
"Total_3"
};
how to get the size of the array MetricsTitleStr, i.e. 3?
It seems like I can get it using sizeof(MetricsTitleStr)/8 = 3. but I do
not know why. can somebody explains the reason? | t****t 发帖数: 6806 | 2 8==sizeof(const char*)
【在 h**o 的大作中提到】 : const char *MetricsTitleStr[] = : { : "Total_1", : "Total_2", : "Total_3" : }; : how to get the size of the array MetricsTitleStr, i.e. 3? : It seems like I can get it using sizeof(MetricsTitleStr)/8 = 3. but I do : not know why. can somebody explains the reason?
| i***h 发帖数: 12655 | 3 a general solution is:
sizeof(MetricsTitleStr)/sizeof(char*) |
|