程序的输出结果为____。#include<stdio.h>union bt{int a;int b[2];};void fun(union bt *c){c->a=-7;c->b[0]=9;c->b[1]=8;}void main( ){union bt c;fun(&c);printf("%d\n", c.a);}
举一反三
- void swap1(int c[]) { int t; t=c[0];c[0]=c[1];c[1]=t; } void swap2(int c0,int c1) { int t; t=c0;c0=c1;c1=t; } void main { int a[2]={3,5},b[2]={3,5}; swap1(a); swap2(b[0],b[1]); printf("%d %d %d %d ",a[0],a[1],b[0],b[1]); } 其输出结果是_______
- 中国大学MOOC: 以下程序的输出结果是void swap1(int c[]){ int t; t=c[0]; c[0]=c[1]; c[1]=t;}void swap2(int c0,int c1){ int t; t=c0; c0=c1; c1=t;}int main( ){ int a[2]={3,5},b[2]={3,5}; swap1(a); swap2(b[0],b[1]); printf(%d %d %d %d ,a[0],a[1],b[0],b[1]); return 0;}
- 有以下程序 void swap1(int c[]) { int t; t=c[0];c[0]=c[1];c[1]=t; } void swap2(int c0,int c1) {int t; t=c0;c0=c1;c1=t; } main() {int a[2]={3,5},b[2]={3,5}; swap1(a); swap2(b[0],b[1]); printf(“%d %d %d %d ”,a[0],a[1],b[0],b[1]); } 执行后输出的结果是:
- 下面程序的运行结果为: main( ) { union bt{ int k; char c[2]; }a; a.k=-7; printf("%o,%o",a.c[0],a.c[1]); }
- 以下程序的运行结果是( )。 void fun(int a[][3], int n) { int j; for(j=0;j A: 1 2 3 B: 2 5 8 C: 3 6 9 D: 7 8 9