TOP CATEGORIES

×

How to use single line comment in C?

A

Arun Verma

Single Line Comment in C

In C programming single line comment is used to hide a line of code from being compiled by C compiler. 

If you are commenting a line then that line is not going to be a part of your C program. Single line comment is very easy to use, just you have to put // at the beginning of the line. Let's take an example.

Example-

int a=20, b=30, c=0;

// sum here

c=a+b;

printf("The sum of a and b is %d", c);

Output

The sum of a and b is 50

In the above program, you can see I have used single line comment 

1 votes

Your Answer

Email: advertise@gdatamart.com

Donate: To Support US

© 2024 GDATAMART.COM (All Rights Reserved)