For a computer to do basic math, it can use logic gates like AND and OR. These logic gates can be made out of voltage sources and resistors, as seen on Wikipedia.

For a computer to do multi-digit math, it also has to store stuff in memory, and then find where it is. However, which circuit components can be combined to make a pointer in memory? This link describes a basic shift-add algorithm - while I slightly understand the methods the computer uses to do math, how does it find which memory unit is the correct one?

  • 3
    \$\begingroup\$ A warm welcome to the site. Your question reads like you have a very elementary understanding of electronics, so unfortunately your question is a few lines asking for mountains of basic electronics teaching in return. Please edit your question and explain your background, level of knowledge, situation and what you are trying to achieve i.e. what made you ask. Thanks and, again, welcome. \$\endgroup\$
    – TonyM
    Jul 22 at 19:04
  • 1
    \$\begingroup\$ Logic gates can be made out of gears and cogs, relays, or sticks and stones, if needed. Pointers are just state that is interpreted as an address instead of as data. It may help you to understand pointers in a very visceral way if you build and use this Cardiac paper computer.. It very simple to build and use. Highly recommended for just learning the basics of data and pointers and computer operations. \$\endgroup\$
    – jonk
    Jul 22 at 19:08
  • \$\begingroup\$ Not sure what troubles you. A 'pointer' stores the address of the data it 'points' to. So it's a kind of memory in the hardware \$\endgroup\$
    – Mitu Raj
    Jul 22 at 19:15
  • \$\begingroup\$ Re, "logic gates can be made out of voltage sources and resistors" As Jonk said, logic gates can be made from many things, but not just voltage sources and resistors. Practical electronic logic gates all pretty much require at least one kind of component with "non-linear" behavior such that it can "switch on" or "off" under different conditions. Electronic logic has been implemented using Transistors, diodes, vacuum tubes, and relays as the "switching" component. Maybe other devices too, but resistors and voltage sources are purely "linear" components that can not "switch on" or "off." \$\endgroup\$ Jul 22 at 20:11
  • \$\begingroup\$ Re, "For a computer to do multi-digit math, it...has to store stuff in memory" That depends on what you mean by "multi-digit." There's no theoretical limit to how "wide" you can build an electronic circuit that adds or multiplies numbers without using any memory. Computers commonly are built with arithmetic hardware that is 8-bits wide, or 16-bits, or 32 or 64-bits wide. But, if you want to do math on numbers that are wider than your computer's hardware, then you can write software to do multiple precision arithmetic, and that software will need memory to hold intermediate results. \$\endgroup\$ Jul 22 at 20:20

A pointer is just a number on most processors. So it's held in the same kinds of memory, caches or registers as any other numbers.

For example, if you have a processor with 16-bit memory addresses, then there are 65536 possible memory locations, numbered from 0 to 65535. So you can "point to" any location in memory simply by storing a number between 0 and 65535.


Not the answer you're looking for? Browse other questions tagged or ask your own question.