-
Notifications
You must be signed in to change notification settings - Fork 15
/
commenting.c
31 lines (30 loc) · 1.34 KB
/
commenting.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
------------------------------------------------------------------------------------
Tutorial: In this tutorial we will see about commenting in C program
Commenting in code is considered as a best practice since programmer can keep short notes explaining what the code does. During execution of a program all the comments are ommitted.
Commenting doesn't have any restrictions or scope. It can be placed anywhere in the program.
There are two types of comments:
1. Single line comment
2. Multi line comment
Explore the below code to get a clear view about commenting in c.
------------------------------------------------------------------------------------
*/
// Code here explaining concept with comments to guide
#include <stdio.h>
int main()
{
// I am a single line comment
int a = 5;
/*
I am a multiline comment
I can occupy any number of lines I need
*/
printf("%d", a); // We can also put comments onto side of a line like this
return 0; /* Even multiline comments can also be placed onto a side of a line */
}
/*
------------------------------------------------------------------------------------
Challenge 1:
Write a C program for addition of two numbers and include comments briefly explaining the each and every line of code.
------------------------------------------------------------------------------------
*/