What do we mean by Byte array?

daydreamer picture daydreamer · Oct 26, 2010 · Viewed 119.5k times · Source

Could someone please explain, I do not exactly get the concept.

What is a Byte Array?

Where and when we use it in applications/programs?

what are the advantages and disadvantages of using a byte array?

Answer

Phil picture Phil · Oct 26, 2010

A byte is 8 bits (binary data).

A byte array is an array of bytes (tautology FTW!).

You could use a byte array to store a collection of binary data, for example, the contents of a file. The downside to this is that the entire file contents must be loaded into memory.

For large amounts of binary data, it would be better to use a streaming data type if your language supports it.