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

loopdemo2(): for()

132
133
134
135
star = 0

loopdemo2()

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

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

Show Advanced options

.

Input was:

0.7 1.3 2.2 3.7 4.8 5.2 6.1 7.3 8.6 9.1

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 mass of star 0
Please enter mass of star 1
Please enter mass of star 2
Please enter mass of star 3
Please enter mass of star 4
Please enter mass of star 5
Please enter mass of star 6
Please enter mass of star 7
Please enter mass of star 8
Please enter mass of star 9
                                                                                                                                                                                                                                                                       

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