This is my c language review question, Thanks for help
这是我的c语言评论问题,感谢您的帮助
What is printed to the screen:
打印到屏幕上的内容:
int main(void)
{
int i, j;
float p, q=6.2;
int t[10];
float *x;
int *y;
x=&q;
j=3;
i=(int)q;
i+=5;
j=i--;
printf("i=%d and j=%d\n", i, j);
//_____________i=10 and j=11__________________________
j=15;
i=11;
i=j&i;
j=i&&j;
printf("i=%d and j=%d\n", i, j);
//_______i=11 and j=1__________________________________
i=4;
j=25;
p=j/i*10+j%3-6;
printf("p=%.2f\n",p);
//__________p=55.00_______________________________
y=t;
for(i=0;i<10;i++)
t[i]=(i==2)?2:(i*2);
y+=2;
printf("the value is %d\n",*y);
//____________the value is 2_____________________________
return 0;
my question is what is the i=j&i and j=i&&j means in part2?
我的问题是什么是i = j&i和j = i && j意味着在第2部分?
in part 3 answer is p=55.00
, By I calculated is (25/2)*10+1-6=57
, why i am wrong?
在第3部分答案是p = 55.00,由我计算是(25/2)* 10 + 1-6 = 57,为什么我错了?
in part 4 what is t[i]=(i==2)?2:(i*2);
means?
在第4部分中,什么是t [i] =(i == 2)?2:(i * 2);手段?
1 个解决方案
#1
Hello I answer your first question: & is a bitwise and is used to perform multiplication bitwise by ejeplo 6 & 6 equals 110 & 110 = 110 as it operates bit by bit, && is a logical and is commonly used in conditional statements example where we need two or more conditions are met simultaneously: if a is greater than 16 and less than 30 run the following code:
你好我回答你的第一个问题:&是一个按位,用于按顺序执行乘法,ejeplo 6和6等于110和110 = 110,因为它一点一点地操作,&&是一个逻辑,并且通常用于条件语句示例中我们需要同时满足两个或多个条件:如果a大于16且小于30,则运行以下代码:
int a = 20;
if (a> 16 && a <30) {
}
#1
Hello I answer your first question: & is a bitwise and is used to perform multiplication bitwise by ejeplo 6 & 6 equals 110 & 110 = 110 as it operates bit by bit, && is a logical and is commonly used in conditional statements example where we need two or more conditions are met simultaneously: if a is greater than 16 and less than 30 run the following code:
你好我回答你的第一个问题:&是一个按位,用于按顺序执行乘法,ejeplo 6和6等于110和110 = 110,因为它一点一点地操作,&&是一个逻辑,并且通常用于条件语句示例中我们需要同时满足两个或多个条件:如果a大于16且小于30,则运行以下代码:
int a = 20;
if (a> 16 && a <30) {
}