What makes computer code ‘work’

816 viewsEngineeringOther

By this I mean, when you write code, what exactly gives that the power to do anything is it more code? 0’s and 1’s? more so, what gives that thing the power to do anything? At some stage I can only deduce what must just be magic making it work because it’ll boil down to something metal and plastic ‘talking to’ an electric current, which doesn’t make sense at all

In: Engineering

17 Answers

Anonymous 0 Comments

Transistors: 3 connections input:output:switch. Apply constant power to the input, and when the switch is high the output is high. These ouputs are fed into other inputs and arranged to allow dynamic selection of operations. So addition verse multiplication depending on a single input.

Code is fed to billions of transistors to actually do the operations. Binary doesn’t always mean 0:low, 1:high. That only applies to storage. So ram and hard drives. When processing you have a clock. When the clock ticks it checks to see if there has been a change. No change=0 change=1.

When writing code I’ll write “if(x==0) x=1;”

In C/C++ it’ll get turned into assembly(asm) when you compile it. The result directly translates to the binary the computer understands.

For javascript there’s a parser that reads it then takes the appropriate actions.

 

This is a cliff notes of the cliffnotes. This is a rather deep subject.

You are viewing 1 out of 17 answers, click here to view all answers.