And for time's sake, I'm not going to bother changing the name all of the time, at least for now.
由于时间的原因,我不会总是,去改变这个文件名字,至少现在不会。
stdio h It pretty much means open this file, standard IO dot H and just paste its contents right here.
它的大致上的意思是打开这个文件,然后把它的内容粘贴在那里。
It's the various programs you run on your computer along with the various data files that you have saved on your hard drive,and so forth.
是你自身这个电脑中运行的各种程序,硬盘存有的各种数据和文件,类似种种。
This is a keyword to Python that says, when it reads this in the file, it says, I'm creating a definition.
这是Python语言的关键词,当你在文件中读到这个词的时候,它的意思就是我正在创建一个定义。
that is,people who were administered,who are governed, but in the sense of having people passing papers back and forth, and having to sign every damn thing you could ever imagine- it's just unbelievable-- before they ever thought of themselves as being citizens.
也就是被治理者,被统治者,不过让人们来回奔忙为了申请批准,还要在每一份该死的文件上签名,从这个意义上来说,在他们视自己为公民前,这是令人难以置信的
When I said in Week One that you don't actually have zeros and ones inside this header file; right?
在第一周我说过的,我们在这个头文件中,是没有二进制的,是吗?
printf I have my includes, standard IO's; so I can use print F, but then I had this thing called a prototype.
我包含了标准输入输出文件,所以我可以使用,然后我有这个原型。
For some reason, at the top of this file, I've also included what I've called a function prototype.
因为一些原因,在这个文件顶端,我包含了一个函数原型。
So, at the very top of the file I'm just copying and pasting what was essentially on the slide a moment ago.
在这个文件的顶端,我只是做了复制和传递。
This is different from the hard disk, which is where files and stuff are permanently stored.
这个和硬盘是不一样的,那是存储,文件之类的东西的。
Let's look at a version two of this file.
看看这个文件的第二个版本。
stdio h This file here is called standard I/O or stdio.h and this is just another text file someone else wrote many years ago and by using that line of code there, I'm telling the computer, give me acces to this code that this other person wrote that's in that file.
在这里的头文件称为标准输入输出文件或,这是由某位前人编写的文本文件,我们只需要刚才所述的一行代码,就能告诉电脑,让我连接到,这个前人在那个文件中写的代码。
So I've got one more piece of bad code on this point and this is buggy five dot c. So as a comment on top bug of this file challenges, what is, in fact, the bug.
所以我在这里得到了一块很烂的代码,这个是buggy5,c,所以作为这个文件顶端的注释,那实际上是那个。
It takes an int; deal with it when you get to it and then once you look through the whole file, should you find -- ultimately find the actual code that defines or impliments this thing.
它携带一个int数,当你获得了它就处理它,然后一旦你查看整个文件,最终你将发现实际代码中,定义或执行了这个东西。
Almost everyone in this room has probably had a segfault at some point or core dump where you end up with this random file called core, which recall is just the contents of memory at the time your program crashed.
几乎这个教室里的所有人,在某个时候,都遇到过段错误,或者通过这个core文件的,存储器内核更新,这就是你的内存出现错误,你的程序崩溃掉了。
It makes sense to me logically that I want to see it first when I open the file; so I scroll on down but only later is increment declared.
这个逻辑上对我是有意义的,打开文件的时候,我想先看到它,所以我向下翻,之后才声明increment函数。
include stdio h The next line of code says include standard io.h which just as a little sanity check contains among other things, printf.
接着的一行代码写着,这个库文件包含一些我们常用的函数,譬如,printf函数。
The convention is not to call it something dot txt but something dot C, just a convention.
但这个文件并不是以XX,txt命名,而是以XX,c命名,这只是一种约定而已。
Because I know this program was saved by default into my current folder, my current directory, so dot slash means run the program called a.out that's right here in my current directory not in, like, a out my applications folder or somewhere else.
程序默认保存在,当前目录下的文件夹,/意味着运行这个名为“a,out“的文件,是我当前目录下的文件,而不是应用程序文件夹或其他别的地方的。
So you have to somehow convert the source code, the C code into 0s and 1s and for that process there exist this tool called a compiler that someone else wrote that takes this stuff as input and produces this stuff as output.
所以你必须把源代码,即C语言代码转换成二进制文件,这个过程就需要我们提到的编译器了,它是由别人编写的一个软件,以这些代码作为输入,将会产生的输出。
LS And what very often happens if you do an LS in your account, to list your files, there's a whole lot of stuff in here at the moment -- and I don't have it here - but what you'll often see -- I'll just fake this demo -- is a file called core.
经常发生的是,如果你用你的账号做一个,来列出你的文件,此刻这里有一大堆元素,-它不在这里,但你们将经常看到--我将篡改这个演示-,是一个叫做core的文件。
There is file now called nonswitch.c among your printouts.
这个有一个叫做nonswitch,c的文件,在你们的打印资料里。
So if I open this file, notice I just did "%d."
所以如果我打开这个文件,请注意我这里有“%d“
So let's go ahead and compile this gcc math1.c.
我们接着通过键入“gcc,math1,c“来编译这个文件。
应用推荐