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 N 4
int sum(int nn[]){
  ...
» int j, s=0; » for (j=0; j<N; ++j) s+=nnj; » return s;
} int main(){
  ...
» int numbers[N], k; » int i, *pq; » pq=numbers; » pq1=8; » *pq=6; » for (i=0; i<N; ++i) { » printf("Please enter value %d\n", i); » scanf("%d", &numbersi); } » for (i=0; i<N-1; ++i) printf("Value %d: %d\n", i, numbers(i+1)); » printf("k?\n"); » scanf("%d", &k); » numbersk=17; » printf("Sum: %d\n", sum(numbers)); » return 0;
}

Data

Memory

sum()

132
133
134
135
nn = 228
136
137
138
139
140
141
142
143
?
?
?
?
j = 2
144
145
146
147
s = 0

main()

216
217
218
219
220
221
222
223
k = -216860
i = -145646168
224
225
226
227
228
229
230
231
pq = -4294750135
numbers[0] = 200
232
233
234
235
236
237
238
239
numbers[1] = -145308857
numbers[2] = -143917056
240
241
242
243
numbers[3] = 1

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

Show Advanced options

.

Input was:

3 1 4 1  1

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

Output

Please enter value 0
Please enter value 1
Please enter value 2
Please enter value 3
Value 0: 1
Value 1: 4
Value 2: 1
k?
Sum: 25
                                                                                                                                                                                                                                                                       

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