对于一维整型数组a,计算其含有多少个数组元素,下列方法正确的有?
A: sizeof(a)/sizeof(a[0])
B: sizeof(a)/sizeof(int)
C: sizeof(a[0])/sizeof(a)
D: sizeof(a[0])/sizeof(int)
A: sizeof(a)/sizeof(a[0])
B: sizeof(a)/sizeof(int)
C: sizeof(a[0])/sizeof(a)
D: sizeof(a[0])/sizeof(int)
举一反三
- 若有下面的数组定义,关于数组a元素个数的选项哪个是错误的( )。inta[]={0,1,2,3,4,5,6,7,8,9};? sizeof(a)/sizeof(a[0])|9|sizeof(a)/sizeof(int)|10
- 【单选题】以下对常见的几种整型数据长度排序正确的是? A. sizeof(int)≤sizeof(short)≤sizeof(long)≤sizeof(long long) B. sizeof(short)≤sizeof(int)≤sizeof(long)≤sizeof(long long) C. sizeof(long long)≤sizeof(long)≤sizeof(int)≤sizeof(short) D. sizeof(int)≤sizeof(long)≤sizeof(short)≤sizeof(long long)
- 下列选项中值与其它选项不相等的是 A: sizeof(int) B: sizeof(float) C: sizeof(unsigned int) D: sizeof(double)
- #include [stdio.h]int main(){ char a, *pa; int c, *pc; pa = &a; pc = &c; *pa = sizeof(pa); *pc = sizeof(pc); printf("%d %d %d %d", a, c, sizeof(a), sizeof(c)); return 0;}
- 06110041:设array为一数组,则表达式sizeof(array)/sizeof(array[0])的结果为( )。