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 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] = 3.4048e-32
128[1] = -2.70174e-08
136
137
138
139
140
141
142
143
128[2] = -3.83773e-38
128[3] = 1.4013e-44
144
145
146
147
148
149
150
151
128[4] = 0
128[5] = 0
152
153
154
155
156
157
158
159
128[6] = 0
128[7] = 0
160
161
162
163
164
165
166
167
128[8] = 0
128[9] = 0

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 4289858712 (0xFFB20C98).

The actual address of allocated memory is the
address shown plus 143290968 (0x88A7258).

Show Advanced options

.
                                                                                                                                                                                                                                                                       

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