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...
#define N 10
int main(){ » float *p=NULL; » p=malloc(N*sizeof *p); » if (p==NULL) { » fprintf(stderr, "Out of memory!\n"); » exit(1); } » for ( int i=0;i<N; ++i) pi=sqrt(i); // Use p for something » return 0; }
...
Memory

Allocated memory

128
129
130
131
132
133
134
135
128[0] = 2.99462e+27
128[1] = 5.49411e+09
136
137
138
139
140
141
142
143
128[2] = -9.78801e+37
128[3] = -5.96209e-27
144
145
146
147
148
149
150
151
128[4] = 0.00025401
128[5] = -3.75646e-06
152
153
154
155
156
157
158
159
128[6] = 3.04637e+17
128[7] = 2.6028e+26
160
161
162
163
164
165
166
167
128[8] = -4.35772e+18
128[9] = -7.70096e-37

main()

300
301
302
303
p = NULL

main(): for()

304
305
306
307
i = 0

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

The actual address of allocated memory is the
address shown plus 139776240 (0x854D0F0).

Show Advanced options

.
                                                                                                                                                                                                                                                                       

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