When we are not collecting return value of the expression (or) if we are not using return value of the expression then it is called dummy statement.
{ Int a; A=10; A*5; ---> dummy statement. Printf (“a=%d”,a); } O/p: a=10 When we are working with dummy statements complier doesn’t gives any error, but we will get a warning msg called “code has no effect”
{ Inta; A=5; A+10 ---> dummy statement Printf(“%d %d %d :,a,a*6,a); } O/p : 5 30 5
{ Int a=; A=5; Printf(“%d %d %d”, a,a=14); } O/p : 10 10 5
{ Int a; A=10; ++a; Printf(“%d%d%d”,a ,a==5,a); } O/p: 11 0 11
{ printf(“A”); Printf(“B”); If(5>8)||if(0) { Printf(“welcome”); Printf(“NIT”); } Printf(“c”); Printf(“D”); } O/p : ABCD
{ Printf(“A”); Printf(“B”); If (5>8) Printf(“welcome”); Printf(“hello); Printf(“c”); Printf(“D”); } O/p : ABHelloCD
{ Printf (“A”); Prinf(“B”); If (5>8); dummy condition { pirntf(“welcome”); Printf(“Hello”); } Printf(“CD”); } O/p: AB Welcome Hello CD If (5>8) { } { Printf(“welcome”); Printf(“Hello”); }
{ Int a; A=1; While (a<=10) { Printf(“%d”,a); ++a; } } O/p : 1 2 3 4 5 6 7 8 9 10
{ Int a; A=1; While (a<=10) Printf(“%d”,a); ++a; } O/p : 1 1 1 1 ….. infinite loop cntrl+break. If the body is not specified for while , then is repeats the statement block by using single statement only until the condition become false, if the condition is no false then we will get infinite loop.
{int a; A=1; While(a<=10); à dummy loop. { Printf(“%d”,a); ++a; } } O/p: no o/p with infinite loop. Here dummy loop is While(a<=10); { } Printf(“%d”,a); ++a;}
{ inta; a=10; if(a=0) assignment printf(“welcome %d”,a); else printf(“Hello%d”,a); } O/p: Hello 0
{ int a; a=0; if (a=-5) printf(“Welcome %d”,a); else printf(“Hello %d”,a); } O/p: Welcome-5
{ int a; a=1; while(a++); printf(“a=%d”,a); } O/p: a=1 (65536)
{ int a; a=1; while(a++<32767); prinft(“a=%d”,a); } O/p: -32768
{ int a; a=-1; while(a- - > -32767); prinft(“a=%d”,a); } O/p:- 32767
{ int a,b; a=b=1; while(a) { A=b++<=3; Printf(“\n %d%d”,ab); } Printf(“\n a=%d b=%d,a+10,b+10); } O/p: 1 6 1 7 1 8 0 9 A=10 b=19
You liked the article?
Like: 1
Vote for difficulty
Current difficulty (Avg): Medium
TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.