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...
// // Demonstrate the break statement as part of a noughts and crosses program // int squareisplayed (int x,int y);// Written elsewhere
int main(){ » int x, y; » printf("Welcome to the noughts and crosses program\n"); » while (1==1) { » printf("Please enter the x and y coordinates in the range 1-3 "); » scanf("%d %d", &x, &y); » if (x<1||x>3||y<1||y>3) printf("\nThe inputs are in the wrong range, please try again.\n\n"); else if (squareisplayed(x, y)) printf("\nSorry, the square (%i, %i) has already been played\n", x, y); else break; } » printf("Your move is: (%d, %d)\n", x, y); » return 0; }
...

Data

Memory

main()

132
133
134
135
x = 1742229137
136
137
138
139
y = -1768189138

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

Show Advanced options

.

Input was:

4 3 2 2 1 3

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

Output

Welcome to the noughts and crosses program
Please enter the x and y coordinates in the range 1-3 
The inputs are in the wrong range, please try again.

Please enter the x and y coordinates in the range 1-3 
Sorry, the square (2, 2) has already been played
Please enter the x and y coordinates in the range 1-3 Your move is: (1, 3)
                                                                                                                                                                                                                                                                       

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