Thread: bytes allocation question

  1. #1
    Registered User
    Join Date
    Sep 2012
    Posts
    50

    bytes allocation question

    Im not sure how to do this, it is in the following link:

    http://i.imgur.com/PKfyL.jpg

  2. #2
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    Aw, that's a shame; Good luck though.
    I hope you find some good reference material on the net about "structure member alignment in C", perhaps using your favourite search engine.

    Also, even for this, you still have to show your attempt first, before we can help you.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  3. #3
    Registered User
    Join Date
    Sep 2008
    Location
    Toronto, Canada
    Posts
    1,834
    There are references made to 'figure 3.1 of your text' and 'alignment rules discussed in lecture'. So you have more information than we do. Especially when it comes to specific size of 'int' which may vary from one machine to another. I would assume that 'double' is 8 bytes, 'short' is 2 bytes. Then just fill in the template with the element names 'c', 'o', 'i', 'd', 's' for the number of bytes they occupy, plus the padding to satisfy alignment rules learned in class.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. printing bytes from memory (NOOB question)
    By MishaMish in forum C++ Programming
    Replies: 7
    Last Post: 01-26-2011, 05:46 AM
  2. Bytes question..
    By lautarox in forum C Programming
    Replies: 9
    Last Post: 10-16-2008, 01:43 PM
  3. memory allocation in bytes
    By sarathius in forum C Programming
    Replies: 17
    Last Post: 03-17-2008, 09:17 AM
  4. working set, virtual bytes and private bytes
    By George2 in forum C++ Programming
    Replies: 3
    Last Post: 01-10-2008, 02:39 AM
  5. Another question about file I/O, bytes and the like
    By StevejLuke in forum C++ Programming
    Replies: 3
    Last Post: 05-12-2002, 09:36 AM

Tags for this Thread