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...
// Demonstrate a simple input check
int main(){
  ...
» double minMass, maxMass; » while (1) { » printf("Please enter the minimum and maximum mass\n"); » scanf("%lg %lg", &minMass, &maxMass); » if (minMass<=0||maxMass<=0) printf("Sorry, the masses must be greater than zero\n"); else if (minMass>maxMass) printf("Sorry, the maximum must not be less than the minimum\n"); else break; } // NB: the above has some non-obvious limitations // which we will address later in the course » printf("Mass range is %g to %g\n", minMass, maxMass);
}

Data

minMass (double)   maxMass (double)
128   136
-1.37546065e+267
  
4.93666517e-270

Memory

main()

128
129
130
131
132
133
134
135
minMass = -1.37546065e+267
136
137
138
139
140
141
142
143
maxMass = 4.93666517e-270

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

Show Advanced options

.

Input was:

-0.9 6.5
9.1 6.5
6.5 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 the minimum and maximum mass
Sorry, the masses must be greater than zero
Please enter the minimum and maximum mass
Sorry, the maximum must not be less than the minimum
Please enter the minimum and maximum mass
Mass range is 6.5 to 9.1
                                                                                                                                                                                                                                                                       

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