单选题 C++
题号 #2607228

假定int类型变量占用两个字节,其有定义int x[10]={0,2,4};,则数组x在内存中所占字节数是(    )。

进入在线模考

参考答案

D

答案解析

x数组共有10个元素,在花括号内只提供3个初值,这表示只给前面的3个成员赋值,后7个元素的值为0,所以,一共有20个字节。

你可能感兴趣的试题

A.for(int a=1;a<=10;a++);
B.int a=1;
do
{
a++:
}while(a<=10);
C.int a=1;
while(a<=10)
{
a++:
}
D.for(int a=1;a<=10;a++)a++;
A.char str[]={’a’,’b’,’C’}
B.char str[2]={’a’,’b’,’c’}
C.char str[2][3]={{’a’,’b’},{’C’,’d’},{’e’,’f’}}
D.char str()={~a,~b,~C}
找试题 · 找答案 · 找资料 在线模考