编程语言'C' [英] Programming language ‘C’

查看:119
本文介绍了编程语言'C'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

#include <stdio.h>
#include <stdlib.h>

int main()
{
int a=4,b=2;
a=b<<a + b>>2;
printf("%d", a);
}





我的尝试:



你好先生,我想知道这一步,如何编译这个程序。

请一步一步解释我。

IDE | GeeksforGeeks |极客的计算机科学门户网站 [ ^ ]

推荐答案

我们无法告诉您 - 我们不知道您使用的是什么编译器或IDE。对于C--一种非常古老的语言 - 当然有数十种可能性,可能有数百种,甚至可能有数千种候选者。



最简单的方法就是去这里:在线C编译器 - 在线编辑器 [ ^ 复制并粘贴它,然后按运行 - 但您可能已经有一个特定的编译器或IDE作为课程的一部分,或者由你正在关注的那本书。如果你的说明不清楚,那么谷歌编译C和编译器或IDE的名称,你应该找到结果。
We can't tell you - we have no idea what compiler or IDE you are using. And for C - a very old language now - there are certainly dozens of possibilities, likely hundreds, and possibly thousands of candidates.

The simplest way would be to go here: Online C Compiler - online editor[^] copy and paste it in, and press "Run" - but the chances are you already have a specific compiler or IDE as part of your course, or that is used by the book you are following. If the instructions you have with that aren't clear, then google "compile C" and the name of the compiler or IDE, and you should find the results.


引用:

你好先生,我想知道这一步,如何编译这个程序。

hello sir, i want to know the step,how to compile this program.



你已经链接过的页面为你执行这项工作。

在Linux机器上,例如你可以发出


The page you linked already performs the job for you.
On a Linux box, for instance you could issue

gcc -Wall -o foo foo.c



编译 foo.c 源代码获取可执行文件 foo

正如Griff所指出的,根据您的环境(操作系统,编译器等),命令行(或GUI按钮)可能不同:阅读相关文档。



实际程序很简单:


to compile the foo.c source code obtaining the executable foo.
As Griff's pointed out, depending on your environment (OS, compiler, etc..) the command line (or the GUI button) maybe different: read the releveant documentation.

The actual program is simple:

int a=4,b=2;



初始化 a ,整数值 4 b 2








initializes a with integer value 4, b with 2.



a=b<<a + b>>2;

a 分配新值。分配的值是 = 运算符右侧的表达式求值结果。为了评估这样的表达式,使用 a b 的当前值,即

Assigns a new value to a. The value assigned is the result of the expression evaluation on the right side of the = operator. In order to evaluate such an expression, current values of a and b are used, i.e.

a = 2<<4 + 2>>2 = 32 + 0 = 32



(有关班次运营商的信息<< >> ,看看 C中的按位操作 - 维基百科 [ ^ ] 。








(For info about shift operators << and >>, have a look at Bitwise operations in C - Wikipedia[^].



printf("%d", a);

输出 a 的值。


这篇关于编程语言'C'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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