0
$\begingroup$

I would define a software program as at least one line of code stored in at least one computer system's memory cell.

Can a software program be stored in just one memory cell or rather (due to binary computation) must it always be stored in two or more memory cells?

$\endgroup$

2 Answers 2

2
$\begingroup$

It depends on the particular instruction set and model of computation, but in some architectures, here is a valid program:

EXIT

In other words, it is just one instruction, which immediately causes the program to halt. If that fits into a single memory cell (and it could; there's no reason in principle why it can't), then you've got a program that fits in one memory cell.

$\endgroup$
1
$\begingroup$

You can even store a software program in 0 memory cells!

All you need to do is to define a programming language in which the empty program has a defined meaning. For example, you can define a programming language that is just like Python, except the empty program prints the string "Hello, World!" to the console; let's call this programming language Python++.

Now you can store a Python++ "Hello, World" program in 0 memory cells.

$\endgroup$
1
  • $\begingroup$ With no sarcasm, sadly I didn't manage to understand what you were trying to say... $\endgroup$ Jan 16, 2022 at 8:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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