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 NSTARS 10
void loopdemo(void){
  ...
» double mass[NSTARS]; » for ( int star=0;star<NSTARS; ++star) { » printf("Please enter the mass of star %i\n", star); » scanf("%lg", &massstar); } // ... Do something interesting
} int main(){
  ...
» loopdemo(); » return 0;
}
Memory

loopdemo(): for()

132
133
134
135
star = 0

loopdemo()

136
137
138
139
140
141
142
143
mass[0] = 4.8745772e-270
144
145
146
147
148
149
150
151
mass[1] = 2.19922194e-314
152
153
154
155
156
157
158
159
mass[2] = -3.89818852e+267
160
161
162
163
164
165
166
167
mass[3] = 8.46661069e-264
168
169
170
171
172
173
174
175
mass[4] = -nan
176
177
178
179
180
181
182
183
mass[5] = 8.46661045e-264
184
185
186
187
188
189
190
191
mass[6] = 4.86522269e-270
192
193
194
195
196
197
198
199
mass[7] = 2.19922194e-314
200
201
202
203
204
205
206
207
mass[8] = 1.492044e-313
208
209
210
211
212
213
214
215
mass[9] = 8.46661045e-264

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

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

Please enter the mass of star 0
Please enter the mass of star 1
Please enter the mass of star 2
Please enter the mass of star 3
Please enter the mass of star 4
Please enter the mass of star 5
Please enter the mass of star 6
Please enter the mass of star 7
Please enter the mass of star 8
Please enter the mass of star 9
                                                                                                                                                                                                                                                                       

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