c - Condition Checking in a FOR loop when checking for an array element -


could please justify output of following code:

#include <stdio.h> void main() {      int i,a[]={0,5};       for(i=0; i<2 && (a[i]==5) ;i++)          printf("%d",i); } 

according me, output should 1. on running code, don't output. please explain happening? new programming , prefer non-complex answer.

because expression a[i]==5 false when i 0. true , false false, loop never runs.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -