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...
struct proj { float mass; float pos[2]; float v[2]; struct proj *next; };
struct proj* newproj(struct proj *f){
  ...
» struct proj *new; » new=malloc(sizeof *new); » new->next=f; » return new;
} int main(){
  ...
» struct proj *first=NULL, *p=NULL; // Allocate a list of four » first=newproj(first); » first=newproj(first); » first=newproj(first); » first=newproj(first); // Now manually remove the third (first->next->next) » p=first->next; » p->next=p->next->next; » return 0;
}
Memory

Allocated memory

128
129
130
131
132
133
134
135
128.mass = 1.34016827e-27
128.pos[0] = 108.914
136
137
138
139
140
141
142
143
128.pos[1] = 4.59974e+28
128.v[0] = -2.39394e+27
144
145
146
147
148
149
150
151
128.v[1] = -3.03973e-38
128.next = -144866916

160
161
162
163
164
165
166
167
160.mass = -2.42451267e-11
160.pos[0] = -3.21033e+25
168
169
170
171
172
173
174
175
160.pos[1] = 5.5288e-27
160.v[0] = 3.70223e-42
176
177
178
179
180
181
182
183
160.v[1] = 0
160.next = NULL

192
193
194
195
196
197
198
199
192.mass = -4.53076604e-11
192.pos[0] = -5.12682e+11
200
201
202
203
204
205
206
207
192.pos[1] = -5.05125e+35
192.v[0] = -4.05599e-34
208
209
210
211
212
213
214
215
192.v[1] = 9.41602e-27
192.next = -144274007

224
225
226
227
228
229
230
231
224.mass = 1721.28857
224.pos[0] = -3.94831e-05
232
233
234
235
236
237
238
239
224.pos[1] = 0.0136082
224.v[0] = -4.13354e-20
240
241
242
243
244
245
246
247
224.v[1] = -1.09478e+09
224.next = -144232236

newproj()

380
381
382
383
f = -4135717160
392
393
394
395
new = -4289895422

newproj()

380
381
382
383
f = NULL
392
393
394
395
new = -4289895422

newproj()

380
381
382
383
f = -4135717128
392
393
394
395
new = -4289895422

newproj()

380
381
382
383
f = -4135717096
392
393
394
395
new = -4289895422

main()

436
437
438
439
first = NULL
440
441
442
443
p = NULL

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

The actual address of allocated memory is the
address shown plus 154178136 (0x9309258).

Show Advanced options

.
                                                                                                                                                                                                                                                                       

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