This preview shows page 1. Sign up to view the full content.
Unformatted text preview: 48414), or locations on the heap (0x8049760 and 0x8049770). Array ip is instantiated twice—once for each call to fun. The second value (0xbfffef68) is smaller than the ﬁrst (0xbfffefa8), because the stack grows downward. The contents of the array, however, are the same in both cases. Element 0 (*ip) is a pointer to variable x in the stack frame for test. Element 1 is a pointer to global variable g. We can see that structure s is instantiated twice, both times on the stack, while the union pointed to by variable up is allocated on the heap. Finally, variable f is a pointer to function fun. In the disassembled code, we ﬁnd the following as the initial code for fun:
1 2 3 4 5 08048414 <fun>: 8048414: 55 8048415: 89 e5 8048417: 83 ec 1c 804841a: 57 push mov sub push %ebp %esp,%ebp $0x1c,%esp %edi The value 0x8048414 printed for pointer f is exactly the address of the ﬁrst instruction in the code for fun.
New to C? Other languages, such as Pascal, provide two different ways to pass parameters to procedures...
View Full Document
This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.
- Spring '10
- The American