Edit: Most of the answers here are wonderful and spot on.
For those who interpreted it differently due to my incorrect and brief phrasing, by ‘teaching’ I meant how does the computer get to know what it has to do when we want it to perform arithmetic operations (upon seeing the operators)?
And how does it do it? Like how does it ‘add’ stuff the same way humans do and give results which make sense to us mathematically? What exactly is going on inside?
Thanks for all the helpful explanations on programming, switches, circuits, logic gates, and the links!
In: 583
Those operations are part of the physical wiring in the processor. Binary addition can be written as a pretty simple combination of AND, OR, NOT, and XOR logic gates, and a computer adds by simply feeding the numbers it’s adding into a bunch of such gates. Typical processors are wired for somewhere around a hundred or a hundred and fifty such basic operations, and all the other instructions in a computer are reduced down to those operations.
Latest Answers