问题

有以下程序

#include <stdio.h>

main()

{ int a[ ]={2,3,5,4},i;

for(i=0;i<4;i++)

switch(i%2)

{ case 0:switch(a[i]%2)

{case 0:a[i]++;break;

case 1:a[i]--;

}break;

case 1:a[i ] =0;

}

for(i=0;i<4;i++) printf("%d",a[i]); printf("\n");

}

程序运行后的输出结果是

A)3 3 4 4

B)2 0 5 0

C)3 0 4 0

D)0 3 0 4

参考答案
您可能感兴趣的试题
  • 有以下程序#include #include main(){ char a[10]=abcd;printf(%d,%d\n,strlen(a),sizeo
  • 下面是有关 C 语言字符数组的描述,其中错误的是A) 不可以用赋值语句给字符数组名赋字符串B) 可以用输入语句把字符串整体输入给字符数组C) 字符数组中的内容不一定是字符串D) 字符数组只能存放字符串
  • 下列函数的功能是fun(char *a,char *b){ while((*b=*a)!= \0) {a++,b++;} }A) 将 a 所指字符串赋给 b 所指空间B) 使指针 b 指向 a 所
  • 设有以下函数void fun(int n,char * s) { …… }则下面对函数指针的定义和赋值均是正确的是A)void (*pf)(); pf=fun;B)viod *pf(); pf=fun
  • 34 ) 有以下程序#include int f(int n);main(){ int a=3,s;s=f(a);s=s+f(a);printf(%d\n,s);}int f(i
  • 有以下程序#include #define f(x) x*x*xmain(){ int a=3,s,t;s=f(a+1);t=f((a+1));printf(%d,%d\n,s,