+ 2

Why we attach ; at the end in C or C++?

The question is in the title: why we have to attach ; at the end of the line in C or C++ languages? Is there any good things if we attach ; at the end?

11th Dec 2016, 11:32 AM
daphne
daphne - avatar
4 Respostas
+ 2
there must be something which tells the compiler that statement has ended , here we have ; developers could.have made another choice but its just their will hence we have ; some programming languages like python dont have ; but instead they use indentation(extra spaces) .
11th Dec 2016, 1:48 PM
manish rawat
manish rawat - avatar
0
it is like ". "We use the end of the sentences ".", the compiler uses ";"
11th Dec 2016, 11:41 AM
Ozan Karataş
Ozan Karataş - avatar
0
in every language there is a sign for showing kind of sentence, for example we put '?' to show our sentence is questioning. in c++ ';' shows that you completed your sentence for definition variables and structural statements.
11th Dec 2016, 11:44 AM
parisa
parisa - avatar
0
the compiler don't know if the line is ended or not. So it need a character to say the line is ended, just like the . in English. So you can write your program like this printn("this is something"); without a error.
11th Dec 2016, 3:37 PM
Maik
Maik - avatar