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...
#define VLEN 3 #define NVECS 4
float length(float vec[VLEN]){
  ...
» float sum=0.0; » int k; » for (k=0; k<VLEN; ++k) sum=sum+veck*veck; » return sqrt(sum);
} int main(){
  ...
» float vecs[NVECS][VLEN]={{1,2,3},{2.1,2.2,2.3}, {9,8,7},{6,5,4}}; » float mag[NVECS]; » int i; » for (i=0; i<NVECS; ++i) magi=length(vecs[i]); » return 0;
}
Memory

length()

132
133
134
135
vec = 280
136
137
138
139
140
141
142
143
?
?
?
?
sum = 0
144
145
146
147
k = -905528

length()

132
133
134
135
vec = 256
136
137
138
139
140
141
142
143
?
?
?
?
sum = 0
144
145
146
147
k = -905528

length()

132
133
134
135
vec = 268
136
137
138
139
140
141
142
143
?
?
?
?
sum = 0
144
145
146
147
k = -905528

length()

132
133
134
135
vec = 244
136
137
138
139
140
141
142
143
?
?
?
?
sum = 0
144
145
146
147
k = -905528

main()

224
225
226
227
228
229
230
231
i = -145444119
mag[0] = -4.31411e+33
232
233
234
235
236
237
238
239
mag[1] = 1.68977e-33
mag[2] = 3.99885e-34
240
241
242
243
244
245
246
247
mag[3] = 3.99876e-34
vecs[0][0] = 1
248
249
250
251
252
253
254
255
vecs[0][1] = 2
vecs[0][2] = 3
256
257
258
259
260
261
262
263
vecs[1][0] = 2.1
vecs[1][1] = 2.2
264
265
266
267
268
269
270
271
vecs[1][2] = 2.3
vecs[2][0] = 9
272
273
274
275
276
277
278
279
vecs[2][1] = 8
vecs[2][2] = 7
280
281
282
283
284
285
286
287
vecs[3][0] = 6
vecs[3][1] = 5
288
289
290
291
vecs[3][2] = 4

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

Show Advanced options

.
                                                                                                                                                                                                                                                                       

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