Otto: C-Nachhilfe in Sachen logische Operatoren

Beitrag lesen

Hi Tom,

Das Stichwort ist Short-circuit evaluation(1). Der Untenstehende Code sollte das veranschaulichen.

  
int foobar (  )  
{  
 printf ("foobar");  
 return 0;  
}  /* -----  end of function foobar  ----- */  
  
  
int  
main ( int argc, char *argv[] )  
{  
 if ( (1 == 0) && foobar () )  
  printf("Hello");  
  
 if ( (1 == 0) & foobar () )  
  printf("Hello");  
  
 return EXIT_SUCCESS;  
}  /* ----------  end of function main  ---------- */  

(1)http://en.wikipedia.org/wiki/Short-circuit_evaluation
MfG
Otto