lets suppose we have the following silly function
Code:
void func()
{
int idiff = 0, x = 7, y = 2;
idiff = x/y;
im sure i read or was told that the value of idiff would be undefined. However, i seem to come across it a lot and used to get the answer 3 in this case.
second question
suppose we have have the following if statement
Code:
if ( func(p) && p > iMax )
{
//some code.....
is that the same as
Code:
//a) or b)
if ( func(p) ) if ( p > iMax )
{ {
if ( p > iMax ) if ( func(p) )
{ {
i know it seems a trivial thing but it could save func being called if p is less than iMax