Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Post History

60%
+4 −2
Q&A Regarding the implementation of data structures.

Since this is pretty clearly a homework exercise, and the point of those is for you to learn, I'm going to be evil and not spoon-feed the answer to you. However, I will give you some pointers. Fi...

posted 2y ago by Canina‭  ·  edited 2y ago by Canina‭

Answer
#4: Post edited by user avatar Canina‭ · 2021-12-07T21:37:33Z (over 2 years ago)
  • Since this is pretty clearly a homework exercise, and the point of those is for you to learn, I'm going to be evil and not spoon-feed the answer to you.
  • However, I will give you some *pointers*.
  • First, consider what the `struct book` *actually contains*. What is the actual variable type of its members? (Which in your example are all the same, but of course could be different if you were to also, say, store the year of publication or the number of pages in or the physical weight of each respective book.) What does that variable type mean for the actual *data* at the specific memory location occupied by an actual *instance* of that struct, such as your `aBook` variable? Basically, if you were to look at the actual memory occupied by `aBook` immediately before the assignments to members of it (which begin at the line that has your comment "how should I write in the double quotes?"), what would you see and how would that relate to what the computer is doing under the hood when running your program? (For simplicity, assume that your program is the only thing that is running on the computer; don't consider things like multitasking, swapping memory to disk, and so on.)
  • Second, considering what you see at the memory occupied by `aBook`, what change would need to be made to that in-memory data (and possibly other memory as well) such that you can use the members of `aBook` to hold a reasonable amount of arbitrary data, such as a book title?
  • Third, in C, how do you make such a change? What does that do to the memory space occupied by the `aBook` variable instance specifically?
  • Fourth, having made that change, how do you store a value such that it can later be read back, using only what's accessible through the `aBook` variable that you do have? Again, what does that do to the memory space occupied by the `aBook` variable instance specifically?
  • Here's a bit of a hint: the answers to the above will also help you find the next book in an arbitrarily-sized library.
  • Since this is pretty clearly a homework exercise, and the point of those is for you to learn, I'm going to be evil and not spoon-feed the answer to you.
  • However, I will give you some *pointers*.
  • First, consider what the `struct book` *actually contains*. What is the actual variable type of its members? (Which in your example are all the same, but of course could be different if you were to also, say, store the year of publication or the number of pages in or the physical weight of each respective book.) What does that variable type mean for the actual *data* at the specific memory location occupied by an actual *instance* of that struct, such as your `aBook` variable? Basically, if you were to look at the actual memory occupied by `aBook` immediately before the assignments to members of it (which begin at the line that has your comment "how should I write in the double quotes?"), what would you see and how would that relate to what the computer is doing under the hood when running your program? (For simplicity, assume that your program is the only thing that is running on the computer; don't consider things like multitasking, swapping memory to disk, and so on.)
  • Second, considering what you see at the memory occupied by `aBook`, what change would need to be made to that in-memory data (and possibly other memory as well) such that you can use the members of `aBook` to hold a reasonable amount of arbitrary data, such as a book title?
  • Third, in C, how do you make such a change? What does that do to the memory space occupied by the `aBook` variable instance specifically?
  • Fourth, having made that change, how do you store a value such that it can later be read back, using only what's accessible through the `aBook` variable that you do have? Again, what does that do to the memory space occupied by the `aBook` variable instance specifically?
  • Here's a bit of a hint and teaser alike: the answers to the above will also help you find the next book in an arbitrarily-sized library.
#3: Post edited by user avatar Canina‭ · 2021-12-07T21:35:23Z (over 2 years ago)
  • Since this is pretty clearly a homework exercise, and the point of those is for you to learn, I'm going to be evil and not spoon-feed the answer to you.
  • However, I will give you some *pointers*.
  • First, consider what the `struct book` *actually contains*. What is the actual variable type of its members? (Which in your example are all the same, but of course could be different if you were to also, say, store the year of publication or the number of pages in or the physical weight of each respective book.) What does that variable type mean for the actual *data* at the specific memory location occupied by an actual *instance* of that struct, such as your `aBook` variable? Basically, if you were to look at the actual memory occupied by `aBook` immediately before the assignments to members of it (which begin at the line that has your comment "how should I write in the double quotes?"), what would you see and how would that relate to what the computer is doing under the hood when running your program? (For simplicity, assume that your program is the only thing that is running on the computer; don't consider things like multitasking, swapping memory to disk, and so on.)
  • Second, considering what you see at the memory occupied by `aBook`, what change would need to be made to that in-memory data (and possibly other memory as well) such that you can use the members of `aBook` to hold a reasonable amount of arbitrary data, such as a book title?
  • Third, in C, how do you make such a change? What does that do to the memory space occupied by the `aBook` variable instance specifically?
  • Fourth, having made that change, how do you store a value such that it can later be read back, using only what's accessible through the `aBook` variable that you do have?
  • Here's a bit of a hint: the answers to the above will also help you find the next book in an arbitrarily-sized library.
  • Since this is pretty clearly a homework exercise, and the point of those is for you to learn, I'm going to be evil and not spoon-feed the answer to you.
  • However, I will give you some *pointers*.
  • First, consider what the `struct book` *actually contains*. What is the actual variable type of its members? (Which in your example are all the same, but of course could be different if you were to also, say, store the year of publication or the number of pages in or the physical weight of each respective book.) What does that variable type mean for the actual *data* at the specific memory location occupied by an actual *instance* of that struct, such as your `aBook` variable? Basically, if you were to look at the actual memory occupied by `aBook` immediately before the assignments to members of it (which begin at the line that has your comment "how should I write in the double quotes?"), what would you see and how would that relate to what the computer is doing under the hood when running your program? (For simplicity, assume that your program is the only thing that is running on the computer; don't consider things like multitasking, swapping memory to disk, and so on.)
  • Second, considering what you see at the memory occupied by `aBook`, what change would need to be made to that in-memory data (and possibly other memory as well) such that you can use the members of `aBook` to hold a reasonable amount of arbitrary data, such as a book title?
  • Third, in C, how do you make such a change? What does that do to the memory space occupied by the `aBook` variable instance specifically?
  • Fourth, having made that change, how do you store a value such that it can later be read back, using only what's accessible through the `aBook` variable that you do have? Again, what does that do to the memory space occupied by the `aBook` variable instance specifically?
  • Here's a bit of a hint: the answers to the above will also help you find the next book in an arbitrarily-sized library.
#2: Post edited by user avatar Canina‭ · 2021-12-07T21:27:22Z (over 2 years ago)
  • Since this is pretty clearly a homework exercise, and the point of those is for you to learn, I'm going to be evil and not spoon-feed the answer to you.
  • However, I will give you some *pointers*.
  • First, consider what the `struct book` *actually contains*. What is the actual variable type of its members? (Which in your example are all the same, but of course could be different if you were to also, say, store the year of publication or the number of pages in or the physical weight of each respective book.) What does that variable type mean for the actual *data* at the specific memory location occupied by an actual *instance* of that struct, such as your `aBook` variable? Basically, if you were to look at the actual memory occupied by `aBook` immediately before the assignments to members of it (which begin at the line that has your comment "how should I write in the double quotes?"), what would you see and how would that relate to what the computer is doing under the hood when running your program? (For simplicity, assume that your program is the only thing that is running on the computer; don't consider things like multitasking, swapping memory to disk, and so on.)
  • Second, considering what you see at the memory occupied by `aBook`, what change would need to be made to that in-memory data such that you can use the members of `aBook` to hold a reasonable amount of arbitrary data, such as a book title?
  • Third, in C, how do you make such a change? What does that do to the memory space occupied by the `aBook` variable instance specifically?
  • Fourth, having made that change, how do you store a value such that it can later be read back, using only what's accessible through the `aBook` variable that you do have?
  • Here's a bit of a hint: the answers to the above will also help you find the next book in an arbitrarily-sized library.
  • Since this is pretty clearly a homework exercise, and the point of those is for you to learn, I'm going to be evil and not spoon-feed the answer to you.
  • However, I will give you some *pointers*.
  • First, consider what the `struct book` *actually contains*. What is the actual variable type of its members? (Which in your example are all the same, but of course could be different if you were to also, say, store the year of publication or the number of pages in or the physical weight of each respective book.) What does that variable type mean for the actual *data* at the specific memory location occupied by an actual *instance* of that struct, such as your `aBook` variable? Basically, if you were to look at the actual memory occupied by `aBook` immediately before the assignments to members of it (which begin at the line that has your comment "how should I write in the double quotes?"), what would you see and how would that relate to what the computer is doing under the hood when running your program? (For simplicity, assume that your program is the only thing that is running on the computer; don't consider things like multitasking, swapping memory to disk, and so on.)
  • Second, considering what you see at the memory occupied by `aBook`, what change would need to be made to that in-memory data (and possibly other memory as well) such that you can use the members of `aBook` to hold a reasonable amount of arbitrary data, such as a book title?
  • Third, in C, how do you make such a change? What does that do to the memory space occupied by the `aBook` variable instance specifically?
  • Fourth, having made that change, how do you store a value such that it can later be read back, using only what's accessible through the `aBook` variable that you do have?
  • Here's a bit of a hint: the answers to the above will also help you find the next book in an arbitrarily-sized library.
#1: Initial revision by user avatar Canina‭ · 2021-12-07T21:25:02Z (over 2 years ago)
Since this is pretty clearly a homework exercise, and the point of those is for you to learn, I'm going to be evil and not spoon-feed the answer to you.

However, I will give you some *pointers*.

First, consider what the `struct book` *actually contains*. What is the actual variable type of its members? (Which in your example are all the same, but of course could be different if you were to also, say, store the year of publication or the number of pages in or the physical weight of each respective book.) What does that variable type mean for the actual *data* at the specific memory location occupied by an actual *instance* of that struct, such as your `aBook` variable? Basically, if you were to look at the actual memory occupied by `aBook` immediately before the assignments to members of it (which begin at the line that has your comment "how should I write in the double quotes?"), what would you see and how would that relate to what the computer is doing under the hood when running your program? (For simplicity, assume that your program is the only thing that is running on the computer; don't consider things like multitasking, swapping memory to disk, and so on.)

Second, considering what you see at the memory occupied by `aBook`, what change would need to be made to that in-memory data such that you can use the members of `aBook` to hold a reasonable amount of arbitrary data, such as a book title?

Third, in C, how do you make such a change? What does that do to the memory space occupied by the `aBook` variable instance specifically?

Fourth, having made that change, how do you store a value such that it can later be read back, using only what's accessible through the `aBook` variable that you do have?

Here's a bit of a hint: the answers to the above will also help you find the next book in an arbitrarily-sized library.