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...
int main(){
  ...
» int n; » printf("Size?\n"); » scanf("%d", &n); /* float (*p )[n]; printf("Size is: %d \n", sizeof *p); p = malloc(n * sizeof *p); p[0][1] = 1; float (*q[2])[n]; q[0] = malloc(sizeof *q[0]); q[1] = malloc(sizeof *q[1]); q[1][0][1] = 8.5; */ » float ( *q2[2][2])[n]; » q2[0]0=malloc(sizeof *q2[0][0]); » q2[1]0=malloc(sizeof *q2[1][0]); » q2[0]1=malloc(sizeof *q2[0][1]); » q2[1]1=malloc(sizeof *q2[1][1]); » q2[1][0][0]1=8.7; » return 0;
}
Memory

Allocated memory

128
129
130
131
132
133
134
135
128[0][0] = -1.05754e+13
128[0][1] = -3.44208e+33
136
137
138
139
128[0][2] = 2.08048e-38

144
145
146
147
148
149
150
151
144[0][0] = -3.5863e-37
144[0][1] = -0.346193
152
153
154
155
144[0][2] = 1.88201e-38

160
161
162
163
164
165
166
167
160[0][0] = -1.28078e-11
160[0][1] = -9.40631e-13
168
169
170
171
160[0][2] = 3.68048e-39

176
177
178
179
180
181
182
183
176[0][0] = -1.70342e+13
176[0][1] = -99.7798
184
185
186
187
176[0][2] = 2.13961e-38

main()

316
317
318
319
n = -145199704
320
321
322
323
324
325
326
327
?
?
?
?
q2[0][0] = 324
328
329
330
331
332
333
334
335
q2[0][1] = 340
q2[1][0] = 356
336
337
338
339
q2[1][1] = 372

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

The actual address of allocated memory is the
address shown plus 136389224 (0x8212268).

Show Advanced options

.

Input was:

3

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

Output

Size?
                                                                                                                                                                                                                                                                       

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