以下程序的输出结果是()。 #include void swap(int x[2]) { int temp; temp = x[0]; x[0] = x[1]; x[1] = temp; } int main() { int a[2]={3,5}; swap(a); printf("%d %d\n",a[0],a[1]); return 0; }
A: 3 5
B: 5 3
C: 3 3
D: 5 5
A: 3 5
B: 5 3
C: 3 3
D: 5 5
举一反三
- 以下程序的运行结果为( )void swap(int x[]){ int temp; temp = x[0]; x[0] = x[1]; x[1] = temp;}void main(){ int a[2]={3,5}; swap(a); printf("a[0]=%d\na[1]=%d\n",a[0],a[1]);}
- 数组x定义:String x[ ][ ]=new int[3][2]; x[0 ][0 ]=”abc”, x[0 ][1]=”12345”;<br/>则 x.length 的值为______ ,x[0][1].leng()的值为______ 。
- 已知x=[[1]]*3,执行语句x[0][0]=5之后,x的值为______ 。
- 已知x=[[1]]*3,那么执行语句x[0][0]=5之后,变量x的值为[[5],[5],[5]]。
- 中国大学MOOC: 已知程序如下:lst=[[1,2],[3,4],[5,6]]for x in lst: print(x[0]*x[1],end=,)执行该程序后,输出结果为:__________ 。