Static analysis I-IV
Lecture 17-20
Table of Contents
Review
Questions about the last class?
Quiz
Will main_1
ever have a runtime error? What about main_2
?
int f(int x, int t) { if (x < 10) { return x / t; } else { return x; } } int main_1() { int input = readInt(); if (input > 10 || input < -10) { input *= -3; } print(f(7, input)); } int main_2() { int input = readInt(); if (input < 5) { input = (input - 10) * -1; } print(f(7, input)); }