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...
int getint (const char text[]);
int main(){
  ...
» int nplayers, nteams; » char message[]="Number of teams?"; » nteams=getint(message); » nplayers=getint("Number of players?"); » return 0;
} // Print out a message, read an integer from the keyboard // and return that integer value. int getint(const char text[]){
  ...
» int val; » printf("%s\n", text); » scanf("%d", &val); » return val;
}
Memory

Fixed strings

134
135
'N' 'u'
136
137
138
139
140
141
142
143
'm' 'b' 'e' 'r' ' ' 'o' 'f' ' '
144
145
146
147
148
149
150
151
'p' 'l' 'a' 'y' 'e' 'r' 's' '?'
152
153
154
155
156
157
158
159
'\0'
?
?
?
?
?
?
?
200
201
202
203
204
205
206
207
?
?
?
?
?
?
'%' 's'
208
209
210
211
212
213
214
215
'\n' '\0'
?
?
?
?
?
?
216
217
218
219
220
?
?
'%' 'd' '\0'

getint()

348
349
350
351
text = -4152972354
360
361
362
363
val = 2

getint()

348
349
350
351
text = 427
360
361
362
363
val = 2

main()

416
417
418
419
420
421
422
423
nplayers = -145104057
nteams = -143712256
424
425
426
427
428
429
430
431
?
?
?
message = 'N' 'u' 'm' 'b' 'e'
432
433
434
435
436
437
438
439
'r' ' ' 'o' 'f' ' ' 't' 'e' 'a'
440
441
442
443
'm' 's' '?' '\0'

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

Show Advanced options

.

Input was:

16 3

Show output (Before looking at the output, work out what you think it put should be and see if you are right.)

Output

Number of teams?
Number of players?
                                                                                                                                                                                                                                                                       

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