+ 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?
4 Réponses
+ 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) .
0
it is like ". "We use the end of the sentences ".", the compiler uses ";"
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.
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.