Skip to content
EMPS intranet

Back to top
Hi!   Hi!           Start program

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 main(){ » while (1) { » double x; » printf("Please enter a positive number, or negative to quit\n"); » scanf("%lg", &x); » if (x<0) break; » printf("The square root of %g is %g\n", x, sqrt(x)); } » return 0; }
...

Data

x (double)
128
2
x (double)
128
4
x (double)
128
3
x (double)
128
2.1828001e+192

Memory

main(): :while {...}

128
129
130
131
132
133
134
135
x = 2

main(): :while {...}

128
129
130
131
132
133
134
135
x = 4

main(): :while {...}

128
129
130
131
132
133
134
135
x = 3

main(): :while {...}

128
129
130
131
132
133
134
135
x = 2.1828001e+192

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

Show Advanced options

.

Input was:

3 4 2 -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 a positive number, or negative to quit
The square root of 3 is 1.73205
Please enter a positive number, or negative to quit
The square root of 4 is 2
Please enter a positive number, or negative to quit
The square root of 2 is 1.41421
Please enter a positive number, or negative to quit
                                                                                                                                                                                                                                                                       

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