How to use single line comment in C?

LAST READ: APR 14 2024 | Q. BY: SANDEEP SINGH

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 Us: advertise@gdatamart.com

Donate Us: Support to GDATAMART

LifeStyle & Fun

© 2024 GDATAMART.COM (All Rights Reserved)