Structs in C (22)

4 Name: #!/usr/bin/anonymous : 2008-08-18 02:00 ID:Tl+qIqZw

>>1

struct is actually more powerful than "objects in OOP" because it can refer to an actual memory layout; consider:

struct data { int a, b; char z[1024]; int c; };

You can now read() and write() an entire struct data and get all of the data serialized to the disk (or deserialized) in one go. An external program can manipulate any of these values and you can then read them back safely. All of these things are guaranteed by the C standard, which is a very valuable thing indeed!

This thread has been closed. You cannot post in this thread any longer.