Skip to content
EMPS intranet

Back to top

Note

  • This code has been compiled to show the internal calculations of the addresses of array elements like this: 824.
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 a=1, b=2, c=3, w=4, x=5, y=6, z=7; » int *pnt=&w; » int arr[2][2][2]; » arr[1][1]0=1.7; » w=arr110; » pnt0=999; » for ( int i=-3;i<=3; ++i) (&w)i=i; » printf("%d %d %d %d %d %d %d\n", a, b, c, w, x, y, z); » printf("%p %p %p %p %p %p %p\n", &a, &b, &c, &w, &x, &y, &z); » return 0;
}
Memory

main(): for()

132
133
134
135
i = -3

main()

136
137
138
139
140
141
142
143
arr[0][0][0] = 165798248
arr[0][0][1] = 165797896
144
145
146
147
148
149
150
151
arr[0][1][0] = -144407831
arr[0][1][1] = -144407615
152
153
154
155
156
157
158
159
arr[1][0][0] = 165798248
arr[1][0][1] = 134538112
160
161
162
163
164
165
166
167
arr[1][1][0] = 134537916
arr[1][1][1] = 1
168
169
170
171
172
173
174
175
pnt = 184
z = 7
176
177
178
179
180
181
182
183
y = 6
x = 5
184
185
186
187
188
189
190
191
w = 4
c = 3
192
193
194
195
196
197
198
199
b = 2
a = 1

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

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

3 2 1 0 -1 -2 -3
0xffea7dfc 0xffea7df8 0xffea7df4 0xffea7df0 0xffea7dec 0xffea7de8 0xffea7de4
                                                                                                                                                                                                                                                                       

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