Skip to content
EMPS intranet

Back to top
Hi!   Hi!           Start main()

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 = 2.16466616e+19
128.str = 2933299065
136
137
138
139
128.length = 1490917

144
145
146
147
148
149
150
151
'V' ' ' ' ' ' ' '%' 'D' ' ' ' '
152
153
154
155
156
157
158
159
' ' ' ' 'M' ' ' ' ' ' ' ' ' ' '
160
161
162
163
'I' ' ' ' ' '\0'

newWotsit()

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

main()

360
361
362
363
william = -4290332847

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

The actual address of allocated memory is the
address shown plus 153371224 (0x9244258).

Show Advanced options

.
                                                                                                                                                                                                                                                                       

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