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 NMAX 32
int main(){
  ...
» int let; » char name[NMAX]; » printf("Please enter your favorite integer, followed by your name\n"); » scanf("%d %[^\n]s", &let, name); » printf("Well %s, %d is an interesting number\n", name, let); » return 0;
}
Memory

Fixed strings

132
133
134
135
'P' 'l' 'e' 'a'
136
137
138
139
140
141
142
143
's' 'e' ' ' 'e' 'n' 't' 'e' 'r'
144
145
146
147
148
149
150
151
' ' 'y' 'o' 'u' 'r' ' ' 'f' 'a'
152
153
154
155
156
157
158
159
'v' 'o' 'r' 'i' 't' 'e' ' ' 'i'
160
161
162
163
164
165
166
167
'n' 't' 'e' 'g' 'e' 'r' ',' ' '
168
169
170
171
172
173
174
175
'f' 'o' 'l' 'l' 'o' 'w' 'e' 'd'
176
177
178
179
180
181
182
183
' ' 'b' 'y' ' ' 'y' 'o' 'u' 'r'
184
185
186
187
188
189
190
191
' ' 'n' 'a' 'm' 'e' '\n' '\0'
?
224
225
226
227
228
229
230
231
?
?
'%' 'd' ' ' '%' '[' '^'
232
233
234
235
236
237
238
239
'\n' ']' 's' '\0' 'W' 'e' 'l' 'l'
240
241
242
243
244
245
246
247
' ' '%' 's' ',' ' ' '%' 'd' ' '
248
249
250
251
252
253
254
255
'i' 's' ' ' 'a' 'n' ' ' 'i' 'n'
256
257
258
259
260
261
262
263
't' 'e' 'r' 'e' 's' 't' 'i' 'n'
264
265
266
267
268
269
270
271
'g' ' ' 'n' 'u' 'm' 'b' 'e' 'r'
272
273
'\n' '\0'

main()

408
409
410
411
412
413
414
415
let = 1
name = ' ' '\0' '\0' '\0'
416
417
418
419
420
421
422
423
'G' '#' ']' ' ' '\0' '`' 'r' ' '
424
425
426
427
428
429
430
431
' ' '\0' '\0' '\0' ' ' '$' ']' ' '
432
433
434
435
436
437
438
439
' ' ' ' ' ' ' ' '3' ' ' ' ' ' '
440
441
442
443
' ' '\0' '\0' '\0'

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

Show Advanced options

.

Input was:

7 John Rowe

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 your favorite integer, followed by your name
Well John Rowe, 7 is an interesting number
                                                                                                                                                                                                                                                                       

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