'Are files data structures?
I'm new to programming and I'd like to know if files such as BMPs, MP3s, EXEs are considered to be data structures as well.
I'm new to programming and I'd like to know if files such as BMPs, MP3s, EXEs are considered to be data structures as well.
Solution 1:[1]
No, they are some form of compressed(or not) data that should be read on any kind of program that can read them.
But they are structured data. That means you have some specific way your program should read them. For example, in bmp you should know how to read its width and height of the image, then start reading its pixels. Then you continue looping it until its over.
There is more complexes structured datas, as exe's, which your operating system reads, or mp3 which you have to execute some algorithms to make the data understandable
Data structures are actually some default way to think about how to store and read your data and use them for specific situations, such as a command history.
The well known command CTRL+Z, CTRL+SHIFT+Z, (undo & redo), they are implemented as stacks, which means each command is piled up one above the other, when undoing you will need to take the command that is topmost in the stack, pop it and execute its undo function.
Solution 2:[2]
Not really. Frow Wikipedia, "In computer science, a data structure is a data organization, management, and storage format that enables efficient access and modification. More precisely, a data structure is a collection of data values, the relationships among them, and the functions or operations that can be applied to the data, i.e., it is an algebraic structure about data."
You normally read or write such files as a whole and do not perform local modifications. Anyway, for some formats (such as TIFF images for instance), the individual data fields can be accessed directly rather than sequentially.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Hipreme |
| Solution 2 | Yves Daoust |
