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

编程入门 行业动态 更新时间:2024-10-22 23:10:10
本文介绍了#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(

本文发布于:2023-11-29 17:23:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1647081.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:lt   amp   include   stdio   main

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!