如何区分电脑2个数据? [英] How do computers differentiate 2 pieces of data?

查看:125
本文介绍了如何区分电脑2个数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道那个电脑店在1和0 /低压和高压,内容十分重要......但那么当我们编译程序,它的形式,所有的信息 - 或存储在补偿只是任何数据 - 是以二进制形式......那么请问电脑2个数据的区别,因为所有它是由0和1组成的流......为了使我的问题更清晰,让我们来可笑的简单code,从C:

I was wondering that computers store all the info in the form of 1s and 0s/low and high voltage, yada yada...but then when we compile the program, it - or just any data stored on the comp - is in binary form...then how does the computer differentiate between 2 pieces of data, since all it consists is a stream of 0s and 1s...To make my question more clear let's take a ridiculously simple code from C:

void main() {
    int A = 0;
    int* pA = &A;
    char c = 'c';
    char* pC = &c;
    return;
}

它不会做任何事情 - 只是使4个变量的类型int,指针为int,char和指向char ...现在这些都将存储在某个地方在0和1的形式......那么,如何计算机是否知道从哪个位做这样或那样的变化的开始以及在哪里结束?对于开始你可能会说电脑有它的地址,还好,理所当然的。但是,我们结束了吗?......又是怎么回事复杂的数据类型,如对象/结构?

it doesn't do anything - just makes 4 variables of types int, pointer to Int, char, and pointer to Char...Now these will be stored somewhere in the form of 0s and 1s...So, how does the computer know from which bit does such and such variable start and where it ends? For start you might say the computer has the address of it, okay, granted. But what about the end?...And what about complex data types like objects/structs?

和最后但并非最不重要的,什么功能/程序?

And last but not the least, what about functions/procedures?

推荐答案

这是你现在阅读的段落也不过是字母和标点符号流。你怎么知道其中一个字开始和结束?你怎么知道是什么的话是什么意思?如何文本此流传达有用的信息?

The paragraph that you're reading right now is nothing but a stream of letters and punctuation. How do you know where one word starts and ends? How do you know what the words mean? How does this stream of text convey useful information?

您能说一下数学同样的事情。当你看到写在页面上数学EX pressions,他们只是一系列数字和符号的,但他们是在一个紧凑的形式传达深理念的有力途径。然后还有音乐。如何圆点,标志该流,并重新线条present东西瞬态音乐?

You can say the same thing about mathematics. When you see mathematical expressions written on a page, they're just a series of numbers and symbols, but they're a powerful way to convey deep ideas in a compact form. And then there's music. How does that stream of dots, flags, and lines represent something as transient as music?

答案,当然是有规则的。字母不只是随机组合 - 他们有一个特定的顺序。当你按照你和我都知道这些规则,你能分辨的话,了解他们的个人意义,并结合成的想法。

The answer, of course, is that there are rules. The letters aren't just combined randomly -- they have a specific sequence. When you follow the rules that you and I both know, you're able to discern the words, understand their individual meanings, and combine them into thoughts.

这是与二进制数据相同。从随机位区分数据的东西是规则,如果跟着,允许位间pretation以有意义的方式存在。现在,你已经问了很多涉及各种规则的问题。试图解释他们都将占用更多的空间比在像这样的一个答案是合理的(和更多的时间比我愿意投入到事业)。但是,如果你拿起一本书上的计算机体系结构,你会发现的规则,他们是如何工作的,他们是如何组织进行充分的讨论,而且他们如何实现的。这真是有趣的东西!

It's the same with binary data. The thing that distinguishes data from random bits is the existence of rules that, if followed, allow interpretation of the bits in a meaningful way. Now, you've asked a lot of questions that involve a variety of rules. Trying to explain them all would take up more space than is reasonable in an answer like this one (and more time than I'm willing to devote to the endeavor). But if you pick up a book on computer architecture, you'll find a full discussion of the rules, how they work, how they're organized, and how they're implemented. It's really interesting stuff!

如果您还没有准备好潜入实际的计算机体系结构然而,一优本书会给你很多有识之士是的哥德尔,埃舍尔,巴赫:永恒的金色编织的由侯世国。这是一本厚书,以及密集的想法。但它也写得很好,有趣,你不一定要从头读到它来掩盖学到很多的东西着迷。

If you're not ready to dive into actual computer architecture yet, one excellent book that will give you a lot of insight is Godel, Escher, Bach: An Eternal Golden Braid by Douglas Hofstadter. It's a thick book, and dense with ideas. But it's also well written and interesting, and you don't necessarily have to read it from cover to cover to learn a lot of fascinating stuff.

这篇关于如何区分电脑2个数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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