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...
#define N 3 void normalise (double p[]);
int main(){ » double a[N]={2.7,5.3,8.3}; » double b[N]={5.8,2.9,3.0}; » double c[N]={-9.6,13.9,6.41}; » normalise(a); » normalise(b); » normalise(c); // More stuff here.. » return 0; }
...
// Normalise a vector (an array) of length N void normalise(double p[]){ » double norm=0; » for ( int i=0;i<N; ++i) norm+=pi*pi; » if (norm>0) { » norm=sqrt(norm); » for ( int i=0;i<N; ++i) pi/=norm; } }
...
Memory

normalise()

132
133
134
135
p = 224
152
153
154
155
156
157
158
159
norm = 0

normalise()

132
133
134
135
p = 248
152
153
154
155
156
157
158
159
norm = 0

normalise()

132
133
134
135
p = 200
152
153
154
155
156
157
158
159
norm = 0

normalise(): for()

148
149
150
151
i = 0

normalise(): for()

148
149
150
151
i = 0

normalise(): for()

148
149
150
151
i = 0

normalise(): for()

148
149
150
151
i = 0

normalise(): for()

148
149
150
151
i = 0

normalise(): for()

148
149
150
151
i = 0

main()

200
201
202
203
204
205
206
207
a[0] = 2.7
208
209
210
211
212
213
214
215
a[1] = 5.3
216
217
218
219
220
221
222
223
a[2] = 8.3
224
225
226
227
228
229
230
231
b[0] = 5.8
232
233
234
235
236
237
238
239
b[1] = 2.9
240
241
242
243
244
245
246
247
b[2] = 3
248
249
250
251
252
253
254
255
c[0] = -9.6
256
257
258
259
260
261
262
263
c[1] = 13.9
264
265
266
267
268
269
270
271
c[2] = 6.41

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

.
                                                                                                                                                                                                                                                                       

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