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...
// // Demonstrate passing an array to a function // (stripped down version ) // #define VALUES 6 void printarray (int output[VALUES]);
int main(){
  ...
» int num[VALUES]={0,1,2,3,4,5}, i; » num2; » printarray(num); » return 0;
} void printarray(int output[VALUES]){
  ...
» int i; » for (i=0; i<VALUES; ++i) { » printf("%d\n", outputi); }
}
Memory

printarray()

132
133
134
135
output = 220
144
145
146
147
i = -8121080

main()

216
217
218
219
220
221
222
223
i = -145267897
num[0] = 0
224
225
226
227
228
229
230
231
num[1] = 1
num[2] = 2
232
233
234
235
236
237
238
239
num[3] = 3
num[4] = 4
240
241
242
243
num[5] = 5

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

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

0
1
2
3
4
5
                                                                                                                                                                                                                                                                       

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