How do i calculate the loop invariant of
Here A is an integerCode:while (A > 1) { A = A / 32; } {A = 1}
How do i calculate the loop invariant of
Here A is an integerCode:while (A > 1) { A = A / 32; } {A = 1}
You could infer A >= 0.
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge
This loop invariant is false only if the loop condition is false so there's no point in having it.
You should not be asked to specify a loop invarant for this loop, there is no point.
'A' may be zero or one after the loop.
My homepage
Advice: Take only as directed - If symptoms persist, please see your debugger
Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"