c语言题目(编程题)

Among the following statements, __ is equivalent to while( *s++ = *t++ );. (2分)

A.do { *s = *t++; } while ( *s++ );
B.while ( *t ) *s++ = *t++;
C.do { *s++ = *t++; } while ( *t );
D.while ( *s ) *s++ = *t++;
答案为啥是A啊?第一次执行的话*s++是啥

while(*s++=*t++); 在语义上等同于(注意条件部分是一个=,不是2个):

while((*t) != 0)
{ *s = *t;
s++;
t++; }
do - while循环是先执行,后判断。追问

但是答案为什么是A呢。这个题的意思是把t这个指针所对应的内容赋值给s指向的东西吧。
现在看A,第一次执行循环,while中是*s++,那*s++是什么?

温馨提示:答案为网友推荐,仅供参考
第1个回答  2018-12-27
#include <stdio.h>
#define N 4 //N---多少行//
#define M 5 //M---多少列//
void main()
{
int a[N][M],i,j,t,k,max,min,l=0;
printf("请输入数组:\n");
for (i=0;i<N;i++)
for (j=0;j<M;j++)
scanf("%d",&a[i][j]);
for (i=0;i<N;i++)
{
max=a[i][0];k=0;
for (j=1;j<M;j++)
if (a[i][j]>max)
{
max=a[i][j];k=j;
}
min=a[0][k];
for (t=1;t<N;t++)
if (a[t][k]<min)
min=a[t][k];
if (max==min)
{printf("所要的数在数组中的%d行%d列值为%d\n",i,t,max);l++}
}
if(l==0)
printf("there is no such number.\n");
}追问

?????
这答案跟题没关系啊

相似回答