杂货店的价钱表常常加新东西,不想每次自己数。用 sizeof 算出数组 prices 里有几个,放进 n,下一行会显示 6 items。
6 items
#include <stdio.h>
int main(void) {
int prices[] = {3, 12, 8, 5, 20, 7};
int n = 0;
// 在这里写:用 sizeof 算出 prices 有几个,放进 n
printf("%d items\n", n);
return 0;
}
写好了先点「运行」试试示例,没问题再点「提交」。