#include< stdio.h> int main(){int a =(1,2,3); int b =(3,2,1); for(; a> 0; a--)for(; b< 3; b ++); printf("%d",a * b);返回0; } [英] #include <stdio.h> int main() { int a=(1, 2, 3); int b=(3, 2, 1); for(; a>0; a--) for(; b<3; b++); printf("%d ", a*b); return 0; }

查看:122
本文介绍了#include< stdio.h> int main(){int a =(1,2,3); int b =(3,2,1); for(; a> 0; a--)for(; b< 3; b ++); printf("%d",a * b);返回0; }的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试了很多,但我没有得到解决你会帮我解决这个问题

谢谢你...... !!



I have tried a lot but I didn't get solved will you help me out with this
thank you...!!

#include <stdio.h> 
int main() 
{   
  int a=(1, 2, 3);   
  int b=(3, 2, 1);   

  for(; a>0; a--)      
    for(; b<3; b++);        

  printf("%d ", a*b); 

  return 0; 
}





我的尝试:



想要使用合适的数字进行expiation

推荐答案

查看C的逗号运算符。当你知道它是如何工作的时候,你就会知道a和b将被初始化为什么。
Look into C's comma operator. When you know how that works, you will know what a and b will be initialized to.


逗号运算符如下所示:

The Comma operator looks like this:
x = a, b;

它计算表达式 a ,丢弃结果,计算 b 并将其返回。

因此 a b 的代码执行,并将x设置为 b 的值。



您的代码只是该代码的扩展名:有效

It evaluates the expression a, discards the result, evaluates b and returns it.
So the code for a and b both get executed, and x is set to the value of b.

Your code is just an extension of that: effectively

x = ((a, b) , c);

所以它评估 a b ,然后评估 c 并设置 x 达到那个价值。

即您的代码是:

So it evaluates a and b, then evaluates c and sets x to that value.
I.e. Your code is:

int main() 
{   
  int a = 3;   
  int b = 1;   
 
  for(; a>0; a--)      
    for(; b<3; b++);        
      printf("%d ", a*b); 
  return 0; 
}


这篇关于#include&lt; stdio.h&gt; int main(){int a =(1,2,3); int b =(3,2,1); for(; a&gt; 0; a--)for(; b&lt; 3; b ++); printf(&quot;%d&quot;,a * b);返回0; }的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆