We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
this exercise has to be removed. it does not work!
nesting a structure inside a structure is just and plainly a bad idea. the outer structure will be allocated in memory on a lower adress, the inner structure at a higher adress. the second outer structure will be allocated right after the first outer structure, i.e. in between the first outer and the first inner structure, if there is space, otherwise it will start overwriting the first inner structure. if there is more or less space can not be directly controlled by the code (at least not the c-code, on assembly level it is no problem.), because this is done by the operation system and the malloc function. so some codes might work here, because for whatever reason they get enough space for the texts that are used here. others don't work without any fault of the code. on my computer even the same code sometimes works, sometimes it does not, because the allocation of memory might differ after a new compilation after undoing a change and restoring an earlier state of the code.
Structuring the Document
You are viewing a single comment's thread. Return to all comments →
this exercise has to be removed. it does not work!
nesting a structure inside a structure is just and plainly a bad idea. the outer structure will be allocated in memory on a lower adress, the inner structure at a higher adress. the second outer structure will be allocated right after the first outer structure, i.e. in between the first outer and the first inner structure, if there is space, otherwise it will start overwriting the first inner structure. if there is more or less space can not be directly controlled by the code (at least not the c-code, on assembly level it is no problem.), because this is done by the operation system and the malloc function. so some codes might work here, because for whatever reason they get enough space for the texts that are used here. others don't work without any fault of the code. on my computer even the same code sometimes works, sometimes it does not, because the allocation of memory might differ after a new compilation after undoing a change and restoring an earlier state of the code.