正在加载图片...
-4- 1c)Draw a memory diagram showing the structure of the memory that has been allocated at the indicated point in the following program: #include <stdio.h> #include <string.h> #include "genlib.h" #include "strlib.h" main ( string si char carray[5],*cptr; strcpy(carray,"abc"); cptr carray +1; *cptr++'x'; s Concat(carray,cptr)i Draw a diagram indicating the contents of memory at this point. Your diagram should include a separate box for each pointer and character cell used by the program.The values of pointer cells should be shown using arrows;the value of any character cells should be shown just by writing the character in the box.Your diagram should also make it clear whether each region of memory is allocated on the stack or the heap.For example,if a pointer variable p on the stack points to a heap cell containing the character 'A',you should indicate that situation using a diagram that looks like this: Stack Heap A Uninitialized memory locations should be left blank.– 4 – 1c) Draw a memory diagram showing the structure of the memory that has been allocated at the indicated point in the following program: #include <stdio.h> #include <string.h> #include "genlib.h" #include "strlib.h" main() { string s; char carray[5], *cptr; strcpy(carray, "abc"); cptr = carray + 1; *cptr++ = 'x'; s = Concat(carray, cptr); Draw a diagram indicating the contents of memory at this point. } Your diagram should include a separate box for each pointer and character cell used by the program. The values of pointer cells should be shown using arrows; the value of any character cells should be shown just by writing the character in the box. Your diagram should also make it clear whether each region of memory is allocated on the stack or the heap. For example, if a pointer variable p on the stack points to a heap cell containing the character 'A', you should indicate that situation using a diagram that looks like this: p Stack Heap A Uninitialized memory locations should be left blank
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有