Why don't we use a semicolon in the end of the functions | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why don't we use a semicolon in the end of the functions

17th Aug 2018, 9:41 PM
Diksha Wagh
Diksha Wagh - avatar
2 Answers
+ 2
thanks it helped
18th Aug 2018, 6:47 AM
Diksha Wagh
Diksha Wagh - avatar
0
Actually, semicolon is used to end a line.  For instance, if you do,  int hash [100]={0}, x, s=20; while (s--) { cin>> x;  hash[x]++;} You need to use a semicolon(;) In order to tell the compiler, that, hey compiler, see this is where I did end this line. Using functions like  sort(a,a+n) ; You also need a semicolon. However, when you write your own function, the function has its space where you write its functionality. Consider, return_something dosomething(take_something) { } Hope, this is something that you needed.
18th Aug 2018, 6:37 AM
Mayur Shedage
Mayur Shedage - avatar