If I'm reading your question right,loops and if statements with one line of code after can be terminated with a semicolon
ie,
if(a > b)
b = a;
is fine. HOWEVER, it is better coding practice to use braces to contain your code. Looks tidier and more uniform.
eg,
if(a > b){
b = a;
}
If you are talking about breaking out of a loop, try using 'break'.
For clasesses it defines from which class to inherit. :: means area of visibility in certain name space.
Of course the for loop is terminated in C. All statements are terminated. Look at the syntax of the for statement... for (init-statement; test-condition; loop-statement) body-statement; That looks quite terminated to me. (By the semi-colon) Perhaps you are thinking about statement blocks... for (init-statement; test-condition; loop-statement) { statement; statement; ... statement; } ... Well, that is just fine because the body-statement, like any other statement, can be replaced by one or more statements enclosed in braces. There is still a terminating semi-colon on each statement. if i am understanding ur ques. right then according to me it is correct that for loop is not terminated because we do not execute for loop.we only check the conditions. those statements are terminated which we want to execute. because using a semicolon or terminating the statement means that statement is execitable.
Sure.for (i=0; i
In some cases it is a separator:for (exp1; exp2; exp3) statement
In C (and C++ and Java), the semicolon is used to mark the end of a statement. It is also used the separate the expressions in a for loop.
Break is used to exit the closest loop. Continue will cause the program to go to the beginning of the loop. for(int x=0;x<10;x++) { //continue; for(int y=0;y<10;y++) { break; } } The break statement causes the inner loop to stop at the first iteration. If the continue statement was uncommented, the inner loop would never be executed because the program would jump back to the beginning(until x = 10 of course).
It's the semicolon after the while ()part:i= 0;do printf ("%d %s\n", i, argv[i]); while (++i
Any teacher will expect you to answer by saying a semicolon (;), but this is not strictly true. First of all, the definition of a "line of code" varies from teacher to teacher and textbook to textbook. Second, even the Java Language Specification lists several types of Java statements which do not need to end in a semicolon.In general, a complete Java statement will end in either of semicolon or a closing block brace.
A semicolon can be used for separating the initial value, condition, and increment statement within a for loop. A comma can be used to separate elements of an array and parameters for methods and classes.
for(assigning initial value;condition;increment/decrement) { statement; }
An iteration is an instance of a structured loop statement (for, while or do-while).
"In endless loop the value of i2 k10 and the loop will terminated when value of you is greater than k and the value of k is assign to 17 after the loop and it is said to endless loop why?"