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...
double max (double x1,double x2);
int main(){
  ...
» double x1, x2, xmax; » printf("Please enter two real numbers\n"); » scanf("%lg %lg", &x1, &x2); » xmax=max(x1, x2); » printf("The maximum of %g and %g is %g\n", x1, x2, xmax); » return 0;
} // Return the maximum of two doubles double max(double x1,double x2){
  ...
» if (x1>x2) return x1; » return x2;
}

Data

max()

x2 (double)   x1 (double)
128   136
71.5
  
-0.5

main()

x1 (double)   x2 (double)
192   200
-2.08783582e+267
  
-8.69105857e+266
xmax (double)
208
4.93653159e-270

Memory

max()

128
129
130
131
132
133
134
135
x2 = 71.5
136
137
138
139
140
141
142
143
x1 = -0.5

main()

192
193
194
195
196
197
198
199
x1 = -2.08783582e+267
200
201
202
203
204
205
206
207
x2 = -8.69105857e+266
208
209
210
211
212
213
214
215
xmax = 4.93653159e-270

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

Show Advanced options

.

Input was:

-0.5 71.5

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 two real numbers
The maximum of -0.5 and 71.5 is 71.5
                                                                                                                                                                                                                                                                       

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