Why we are intializing inc ans exc by 0
Why we are intializing inc ans exc by 0
You mean variables
inc, ans, exc
initially?
You don’t really need to initialize ans, exc
.
But, we need to initialize at least inc
, because it is possible that the if codition is not executed and therefore the value in inc
will be just garbage value, which will cause problem in
ans = max(inc, exc);