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...
// 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] = 3.97963e+33
176
177
178
179
180
181
182
183
farray[1] = 1.53226e+27
farray[2] = 1.02694e-17
184
185
186
187
188
189
190
191
farray[3] = 2.38715e+28
farray[4] = -1.58221e+25
192
193
194
195
196
197
198
199
farray[5] = 7.25692e-08
farray[6] = -1.75688e+17
200
201
202
203
204
205
206
207
farray[7] = -4.49525e+33
farray[8] = 5.05323e-20
208
209
210
211
212
213
214
215
farray[9] = 1.35208e-11
farray[10] = 2.03765e+24
216
217
218
219
farray[11] = -2.70227e-25

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

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