C programming tutorial
By default the instructions in a program are executed sequencially.But Many times in real world c programming It is often required that certain block of statements executes only if certain condition are met or evaluates to be true.There come the role of if statement.
if(condition)
{There is no need of putting braces if number of statements inside if is one.
In above example.
condition is checked ,since i=2 hence less then 3,statements inside if are executed.
hence "c programming" will be printed on screen.
Note:In C a non zero value is considered to be true and a zero is considered as false.
On the basis of above note guess the output of following program
main()
{
if (6/5)
printf(" Where ");
if(a=10)
printf(" my ");
if(-2)
printf("wife");
if(a)
printf("is");
if(5/6)
printf("huh");
}