用C编写的代码的输出是什么 [英] What is the output to this code written in C

查看:112
本文介绍了用C编写的代码的输出是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

#include<stdio.h>
{
 int a=10,b=15,c=20;
 c=a+b;
 prinf("%d\n",c);
}





我的尝试:



我想尽快得到这个答案。



What I have tried:

I Want this answer as soon as possible.

推荐答案

运行它并看看。

但我会给你有一个线索:这是一个编译器错误,沿着预期标识符或'(''''''''''''''''''''''''''''''''''' $ c> main 函数是为了工作 - 所以编译器知道从哪里开始执行。没有它,你根本没有应用程序,它不会运行或输出任何东西。 br $>
Plus ... printf 需要't'才能被识别。

除此之外,你怎么看?它应该输出?如果我要求你添加10和15并告诉我你得到的总数,你会期待什么?



Run it and see.
But I'll give you a clue: it's a compiler error, along the lines of "expected identifier or '(' before '{' token"

Your C program needs a main function in order to work - so the compiler knows where to start executing. Without that, you don't have an app at all, and it won't run or output anything.
Plus ... printf requires a 't' to be recognised.
Other than that, what do you think it should output? What would you expect if I asked you to add 10 and 15 and tell me what total you got?

#include <stdio.h>

int main()
{
    int a=10,b=15,c=20;
    c=a+b;
    printf("%d\n",c);
    return 0;
}


这不会编译,因为基本规则不符合,如前所述。



深入了解教程学习C ++ ,了解编码的基础知识。
This wont compile, because basic rules arent met, as written before.

Dig through the tutorial Learn C++ to learn the basic of coding.


这篇关于用C编写的代码的输出是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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