Skip to content
EMPS intranet

Back to top
Hi!   Hi!           Start program

Try stepping through the code


  Value and type of last evaluated expression: Address of array element: Address of array elementx:  (none)

Your browser does not support the canvas element which will make some the features unavailable.

If you are using Internet Explorer within the University of Exeter try going to the Settings menu (probably the gear shape at the top right of this page), selecting "Compatibility View settings", unchecking "Display intranet sites in Compatibility View" and reloading this page.

Code

 Header...
typedef struct wotsit { float val; char *str; int length; }Wotsit;
Wotsit* newwotsit(int len){ » Wotsit *w; » w=xmalloc(sizeof *w); » w->length=len; » w->val=0; » w->str=xmalloc(w->length); » return w; }
...
int main(){ » Wotsit *william; » william=newwotsit(20); » snprintf(william->str, william->length, "Hello, world\n"); » return 0; }
...
Memory

Allocated memory

128
129
130
131
132
133
134
135
128.val = 4.90576264e+33
128.str = 1932826409
136
137
138
139
128.length = 1612158611

144
145
146
147
148
149
150
151
'Y' '>' ' ' ' ' ' ' ' ' ' ' 'r'
152
153
154
155
156
157
158
159
' ' ' ' ' ' ' ' '$' ' ' 'N' ' '
160
161
162
163
'b' '4' 'z' '~'

newwotsit()

296
297
298
299
300
301
302
303
w = 376
?
?
?
?
336
337
338
339
len = 20

main()

360
361
362
363
william = -1763361458

NB: the actual memory address of each variable is the
address shown plus 4290090464 (0xFFB595E0).

The actual address of allocated memory is the
address shown plus 161276144 (0x99CE0F0).

Show Advanced options

.
                                                                                                                                                                                                                                                                       

Validate   Link-check © Copyright & disclaimer Share
Back to top