Home » Programming Tips & Tricks » C - Tips & Tricks

C comments within a statement

By: IncludeHelp, on 07 FEB 2017

I have discussed about the comments, we can put a comments anywhere in the program by using comment characters /*...*/

But, do you know? We can also put a comment within the statement by using the same comment characters.

Consider the following statement

if(a>=b && a!=0)
	printf("some statement.\n");

If we do not want to check a!=0, we can put this expression with && operator in the comment, like this:

if(a>=b /*&& a!=0*/)
	printf("some statement.\n");

Now, program will check only a>=b.






Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.




Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.