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

normalise()

132
133
134
135
p = 208
136
137
138
139
140
141
142
143
?
?
?
?
norm = 0
144
145
146
147
148
149
150
151
i = -6743080
?
?
?
?
184
185
186
187
188
189
190
191
?
?
?
?
n = 2

normalise()

132
133
134
135
p = 228
136
137
138
139
140
141
142
143
?
?
?
?
norm = 0
144
145
146
147
148
149
150
151
i = -6743080
?
?
?
?
184
185
186
187
188
189
190
191
?
?
?
?
n = 4

normalise()

132
133
134
135
p = 216
136
137
138
139
140
141
142
143
?
?
?
?
norm = 0
144
145
146
147
148
149
150
151
i = -6743080
?
?
?
?
184
185
186
187
188
189
190
191
?
?
?
?
n = 3

main()

208
209
210
211
212
213
214
215
a[0] = 2.7
a[1] = 5.3
216
217
218
219
220
221
222
223
b[0] = 5.8
b[1] = 2.9
224
225
226
227
228
229
230
231
b[2] = 3
c[0] = -9.6
232
233
234
235
236
237
238
239
c[1] = 1.4
c[2] = 13.9
240
241
242
243
c[3] = 6.41

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

Show Advanced options

.
                                                                                                                                                                                                                                                                       

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