-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathc6.txt
65 lines (56 loc) · 1.64 KB
/
c6.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
**Code Generation test case 6: Dynamic type checking with staic arrays
Single driver module with multiple levels of nesting
**
<<<driver program>>>
start
declare m, n,p, k, x, y, z:integer;
declare A, B, C: array[6..10] of integer;
get_value(A);
get_value(B);
p:= 7;
for(k in 1..3)
start
get_value(m);
get_value(n);
x:= A[m]+B[n];
y:= A[p]+B[n];
z:= A[m]+B[p];
print(x);
print(y);
print(z); **As long as there is no run time error with respect to the bounds, x, y, z get printed**
end
end
** On the console
Input: Enter 5 array elements of integer type for range 6 to 10
2
-6
4
10
-8
Input: Enter 5 array elements of integer type for range 6 to 10
-5
-15
7
-3
4
Input: Enter an integer value [Note: Iteration 1: reading values of m and n]
6
Input: Enter an integer value
8
Output: 9
Output: 1
Output: -13 [Note: Run time bound checking went successfull in iteration 1]
Input: Enter an integer value [Note: Iteration 2: reading values of m and n]
8
Input: Enter an integer value
10
Output: 8
Output: -2
Output: -11 [Note: Run time bound checking went successfull in iteration 2]
Input: Enter an integer value [Note: Iteration 3: reading values of m and n]
5
Input: Enter an integer value
7
RUN TIME ERROR: Array index out of bound [Note: Run time bound checking is done and reported here as A[5] is an error, Aborted execution]
Similarly run the generated assembly code for other input values and verify.
**