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...
// myfun expects the address of a float (and implicitly that // this float is the first elemnt of an array)
void myfun(float p[]){
  ...
» p0=3.7;// Set the first element of the array
} int main(){
  ...
» float farray[12]; » myfun(farray); » printf("%g\n", farray0);// Prints 3.7 » return 0;
}
Memory

myfun()

128
129
130
131
p = 172

main()

172
173
174
175
farray[0] = 1.4013e-45
176
177
178
179
180
181
182
183
farray[1] = -nan
farray[2] = -4.2718e+33
184
185
186
187
188
189
190
191
farray[3] = 1.4013e-45
farray[4] = 2.8026e-43
192
193
194
195
196
197
198
199
farray[5] = -4.37619e+33
farray[6] = -4.80693e+33
200
201
202
203
204
205
206
207
farray[7] = 1.4013e-45
farray[8] = -4.37626e+33
208
209
210
211
212
213
214
215
farray[9] = 3.99793e-34
farray[10] = 3.99784e-34
216
217
218
219
farray[11] = 1.4013e-45

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

Show Advanced options

.
Show output (Before looking at the output, work out what you think it put should be and see if you are right.)

Output

3.7
                                                                                                                                                                                                                                                                       

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