What does the following example do?void send(int* to,int* from,int count){ int n=(count+7)%8; switch(count%8) { case 0: do { *to++ = *from++; case 7: *to++ = *from++; case 6: *to++ = *from++; case 5: *to++ = *from++; case 4: *to++
来源:学生学帮网 编辑:学帮网 时间:2024/06/17 15:17:18
What does the following example do?
void send(int* to,int* from,int count)
{
int n=(count+7)%8;
switch(count%8)
{
case 0: do { *to++ = *from++;
case 7: *to++ = *from++;
case 6: *to++ = *from++;
case 5: *to++ = *from++;
case 4: *to++ = *from++;
case 3: *to++ = *from++;
case 2: *to++ = *from++;
case 1: *to++ = *from++;
}while(--n>0);
}
}
//The C++ Programming Language (Third Edition) CH6 - 15
主要目的是把从from开始拷贝数据到to.
拷贝数量是 ( ( ( count + 7 ) % 8 ) - 1 ) * 8 + ( count % 8 ) 个元素.
第一次从count%8开始,依次执行 case count%8-1,case count%8-2 ..到
case 1,
然后循环n-1次,执行 do {} 中间的代码.
they follow the rules,for what
what does the sign
follow the
follow the
follow the
follow the
follow the
What does the man do?
what does the man mean
what does the man want
what does the woman want?
What does the teacher say?
What does the boy ----- doing?
What does the boy do
“What does the writer do?
what does the teacher like
What does the fox say?
what does the sign mean.