C语言编辑器获取数组中元素个数

来源:互联网 发布:舞台音乐控制软件 编辑:程序博客网 时间:2024/06/05 23:23
#include<stdio.h>int main(void){/* code */const int days[] = {31,28,31,30,31,30,31,31,30,31,30,31};int index;for (index = 0; index < sizeof days / sizeof days[0]; index++){/* code */printf("Month %2d has %d days.\n", index+1, days[index] );}return 0;}

0 0
原创粉丝点击