[go: up one dir, main page]

0% found this document useful (0 votes)
10 views21 pages

Unit-2-Cprg

The document covers C operators and expressions, including arithmetic, relational, logical, assignment, increment/decrement, conditional, bitwise, and special operators. It also discusses control structures such as decision-making statements and looping statements, detailing their syntax and usage. The document emphasizes operator precedence, expression evaluation, and the flow of control in programming using selection and branching statements.

Uploaded by

Anand Patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views21 pages

Unit-2-Cprg

The document covers C operators and expressions, including arithmetic, relational, logical, assignment, increment/decrement, conditional, bitwise, and special operators. It also discusses control structures such as decision-making statements and looping statements, detailing their syntax and usage. The document emphasizes operator precedence, expression evaluation, and the flow of control in programming using selection and branching statements.

Uploaded by

Anand Patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

DMSMs College of Computer Applications, Belgaum 9880177097

Unit 2: C Operators and Expressions, Control Structures


C Operators & Expressions: Arithmetic operators; Relational operators; Logical operators;
Assignment operators; Increment & Decrement operators; Bitwise operators; Conditional
operator; Special operators; Operator Precedence and Associatively; Evaluation of arithmetic
expressions; Type conversion.
Control Structures: Decision making Statements - Simple if, if_else, nested if_else, else_if ladder,
Switch Case, goto, break & continue statements; Looping Statements - Entry controlled and exit
controlled statements, while, do-while, for loops, Nested loops.

Operators in C
An operator is a symbol that tells the computer to perform some mathematical or logical
manipulation. Operators are used in programs to manipulate data and variables.
Operators are usually a part of the mathematical or logical expressions. Generally the usage of an operator is
as shown below:

operand1 op operand2

In the above format, operand1 and operand2 can be either data or variables or expressions. Op is
the operator. In C, based on the number of operands on which an operator can operate, the
operators are divided into three types namely: unary, binary and ternary.
Unary operators work on single operand, binary operators work on two operands and ternary
operators work on three operands.
There are 8 different categories of C operators as shown below:
– Arithmetic (+, -, *, /, %)
– Relational (>, >=, <, <=, ==, !=)
– Logical (&&, ||, !)
– Assignment (=)
– Increment, Decrement (++, --)
– Conditional (? : )
– Bitwise (<<, >>, &, |, ^)
– Special (comma, sizeof, pointer)

Arithmetic Operators
C provides all the basic arithmetic operators. The arithmetic operators can operate on any built-in
data type in C. The unary minus operator multiplies its single operand with -1. Integer division

Programming in C (2021-22) Unit 2 Page 1


DMSMs College of Computer Applications, Belgaum 9880177097

truncates any fractional part. The modulo division operator (%) produces the remainder of an
integer division. The modulo operator cannot be used on floating point values.

Operator Meaning Example


+ Addition or unary plus a+b
– Subtraction or unary minus a-b
* Multiplication a*b
/ Division (Quotient) a/b
% Modulo (Remainder) a%b
Integer arithmetic : When both operands are integers the arithmetic that happens results in a
integer value. This is called an integer expression.
For example,
If a = 14 and b = 4, then
a–b =10
a+b =18
a*b = 56
a/b = 3 decimal part truncated
a%b = 2 remainder of division
Real arithmetic: If both operands are real, the result will also be real.
For example,
x = 6.0/7.0 = 0.857143
y = 11.0+3.25 = 13.25
z = 12.0*2.5 = 30.0
a = 13.5-2.4 = 11.1
Mixed mode arithmetic: If the operands are mixed, i.e., one integer and the other real, the result
will be a real value.\
For example,
15/10.0 = 1.5

Relational Operators:
In C, whenever there is a need to compare two values and make a decision based on the outcome
of the comparison, we use relational operators.
For example, we can compare a person’s age with a value and based on whether the person’s age
is less than or equal or greater than the value, we may take a decision.

Programming in C (2021-22) Unit 2 Page 2


DMSMs College of Computer Applications, Belgaum 9880177097

The relational operators in C are as shown below:

Operator Meaning Example


< Less than a<b
<= Less than or equal to a<=b
> Greater than a>b
>= Greater than or equal to a>=b
== Equal to a==b
!= Not equal to a!=b
The relational operators are generally used in decision making statements like if, else if and in
looping statements like for, while, do while etc. Relational operators always evaluates to 0 (false)
or 1 (true).

Logical Operators:
The relational operators are used to compare at most two values i.e. testing one condition. To test
more than one condition, we use logical operators along with relational operators.
The logical operators always evaluates to either 0 or 1 like relational operators. The logical
operators available in C and their corresponding truth tables are as shown below:

Operator Meaning Example


&& Logical AND (a>b)&&(a>c)
|| Logical OR (a>b)||(a>c)
! Logical NOT !(a>b)

Assignment Operator:
The assignment operators are used to assign value of an expression to a variable. The general
assignment operator is = (equal). In C, there are some special assignment operators known as
shorthand operators. The syntax of shorthand operators is as shown below:
var op=expr;
In the above shown syntax, var is a variable, op is an arithmetic operator and exp can be any
expression or value or a variable. The use of shorthand operators has three advantages:
1. Easier to write.
2. The statement is more concise and easier to read.
3. The statement is more efficient.
The assignment operators in C are as shown below:

Programming in C (2021-22) Unit 2 Page 3


DMSMs College of Computer Applications, Belgaum 9880177097

Operator Example
= a = 10
+= a+=10 (a=a+10)
-= a-=10 (a=a-10)
*= a*=10 (a=a*10)
/= a/=10 (a=a/10)
%= a%=10 (a=a%10)

Increment/Decrement Operators:
The increment and decrement operators provided by C are used to increment or decrement the
operand by a value of one. Both the increment and decrement operators are unary operators.
These operators are used extensively inside for loop and while loop.
There are two variations in how the increment and decrement operators can be used. They are as
shown below:
var++ var-- postfix
or
++var --var prefix
In the above shown syntax, var++ is known as post increment(postfix increment) and ++var is
known as pre increment (prefixincrement). Although both of them increment the variable by a
value of one, they behave differently when they are used in expressions.
In expressions, when post increment is applied, the value of the variable is used in the evaluation
of the expression and after the expression is evaluated, the value of the variable is incremented by
a value of one.
When pre increment is applied, the value of the variable is incremented by one first and then that
value is used for evaluation of the expression.
The increment and decrement operators available in C are:

Operator Meaning Example


++ Increment by 1 A++ or ++A
-- Decrement by 1 A-- or --A
For example, int b, c, x, y;
b=6;
c=3;
x=c*b++;
y=b+--c;
printf(“%d, %d, %d, %d”, b, c, x, y); gives b = 7, c=2, x = 18, y = 9

Programming in C (2021-22) Unit 2 Page 4


DMSMs College of Computer Applications, Belgaum 9880177097

Conditional Operator:
The conditional operator “? :” in C, is a ternary operator, which operates on three operands. This operator is
used to construct conditional expressions of the form:

exp1?exp2:exp3;

where exp1 is a relational expression(comparison) and is evaluated first. If TRUE, then exp2 is
evaluated or otherwise exp3 is evaluated.
For example,
a=10; b=15;
x = (a>b) ? (a-b) : (b+a);
Here, x will be evaluated to 25.
But if,
a=15; b=10;
x = (a>b) ? (a-b) : (b+a);
then, x will be evaluated to 5.

Bitwise Operators:
C supports a set of operators which operate at bit-level. These operators are known as bitwise
operators. The bitwise operators are used for testing a bit, setting a bit, complementing a bit or for
shifting the bits to left or right. The bitwise operators available in C are as shown below:

Operator Meaning Example


& Bitwise AND a&b
| Bitwise OR a|b
^ Bitwise Exclusive OR a^b
~ Bitwise NOT ~a
<< Left Shift a<<1
>> Right Shift a>>1
The truth table for the bitwise operators is as shown below:

Programming in C (2021-22) Unit 2 Page 5


DMSMs College of Computer Applications, Belgaum 9880177097

Special Operators:
C supports some special operators such as comma “,” operator, sizeof operator, address “&”
operator, pointer operator “*” and some others.
• comma operator
• sizeof operator
• pointer operators, & and *
• member selection operators, . and ->
Comma Operator: The comma “,” operator is used to combine multiple related expressions
together. A comma separated list of expressions is evaluated from left to right and the value of the
right most expression is the value of the combined expression.
For example,
value = (x=10, y=5, x+y);
gives value = 15
comma is also used for interchanging values
t=x, x=y, y=t;
Also used in for and while loop.
sizeof operator: The sizeof operator computes the size of an expression or variable or constant or
a data type. This operator is used extensively for determining the length of an array, structure or
union when the programmer does not know their actual sizes.
The sizeof operator is also used in dynamic memory allocation. The general syntax
of sizeof operator is as shown below:
var = sizeof(operand);
where the operand can be either a value or variable or data type or an expression
For example,
int sum;
m = sizeof(sum);
y = sizeof(short int);
k = sizeof(67L);
It is a compile time operator.

Programming in C (2021-22) Unit 2 Page 6


DMSMs College of Computer Applications, Belgaum 9880177097

Arithmetic Expression:
An expression is a sequence of operands and operators that reduces to a single value. For example,
the expression, 10+5 reduces to the value of 15.
Based on the operands(variables or constants) and operators used in the expression, they are
divided into several types. Some of them are:
1. Integer expressions – expressions which contains integers and operators
2. Real expressions – expressions which contains floating point values and operators
3. Arithmetic expressions – expressions which contain operands and arithmetic operators
4. Mixed mode arithmetic expressions – expressions which contain both integer and real
operands
5. Relational expressions – expressions which contain relational operators and operands
6. Logical expressions – expressions which contain logical operators and operands
7. Assignment expressions and so on… – expressions which contain assignment operators and
operands
Examples of some expressions in C are

Expression Evaluation:
The general form of an expression in C is as follows:
var = expression;
When above statement is encountered, first the expression on the right hand side is evaluated,
and then the result is assigned to the variable on the left hand side. For example,
x = a*b-c;
z = a – b / c + d;
Expressions are evaluated based on operator precedence and associativity rules when an
expression contains more than one operator.

Programming in C (2021-22) Unit 2 Page 7


DMSMs College of Computer Applications, Belgaum 9880177097

Operator Precedence and Associativity:


Arithmetic expressions are evaluated from left to right based on priority of operators.
High priority : * / %
Low priority : + -
Precedence can be changed by using parenthesis ( ). For example, the three expressions will give
different results.
9 – 12 / 3 + 3 * 2 – 1 will get evaluated to 10
9 – 12 / (3 + 3) * (2 – 1) will get evaluated to 07
9 – (12 / (3 + 3) * 2) – 1 will get evaluated to 04
All operators have a level of precedence. This decides which operators will be evaluated before
others. Higher level precedence operators are evaluated first, followed by a lower level
precedence operators.
There is also associativity property of operators where operators of same precedence are
evaluated either from ‘left to right’ or ‘right to left’ depending on associativity.
The following table shows the precedence level and operator associativity.

Programming in C (2021-22) Unit 2 Page 8


DMSMs College of Computer Applications, Belgaum 9880177097

Decision Making and Branching:


In C, until so far, in all the programs, the control is flowing from one instruction to next instruction.
Such flow of control from one instruction to next instruction is known as sequential flow of
control.
But, in most of the C programs, while writing the logic, the programmer might want to skip some
instructions or repeat a set of instructions again and again. This is can be called as non-sequential
flow of control. The statements in C, which allows the programmers to make such decisions, are
known as decision making statements or control statements.
In C, there are two types of decision making statements. One type is used to branch the control
into different ways and the other type is used to repeat a set of instructions again and again. The
two types of decision making statements are:
1. Selection statements or Branching statements
2. Looping statements

Selection Statements or Branching Statements:


The selection statements in C enable the programmer to select a set of instructions to be executed
by the CPU. This selection is based on a condition. C also supports a set of unconditional branching
statements which transfers the control to some other place in the program. The selection
statements in C are:
1. if statement
2. switch statement
3. Conditional operator statement
4. goto

If statement:
This is a decision making statement used with an expression. The expression will be a comparision
operation, using relational operators. Based on the evaluation of the test expression, which will
either result in a TRUE(1) or a FALSE(0) value, some statements will be executed, or will be
skipped. The general form of the if statement is as shown below:
if (test-expression)
Some examples
1. if (bank balance is zero)
borrow money

Programming in C (2021-22) Unit 2 Page 9


DMSMs College of Computer Applications, Belgaum 9880177097

2. if (room is dark)
put on lights
3. if (code is 1)
person is male
4. if (age is more than 55)
person is retired
The different form of the if statement are:
1. Simple if statement
2. if …… else statement
3. Nested if …. else statement
4. else if ladder

Simple if statement or null else:


The simple if allows the programmer to execute or skip a set of instructions based on the value of a
condition. The simple if is a one way selection statement.
If the condition is true, a set of statements will be executed. If the condition is false, the control
will continue with the next statement after the if statement. The simple if can be represented
diagrammatically as shown below:
Its syntax is
if (test expression)
{
statement-block;
}
statement-x;
where, statement-block may be a single statement or a group of statements
If test expression is true, statement-block will be executed, otherwise statement-block will be
skipped and execution will jump to statement-x
When test expression is true, both statement-block and statement-x will be executed.
For example,
• Students who take part in sports should be given bonus marks

Programming in C (2021-22) Unit 2 Page 10


DMSMs College of Computer Applications, Belgaum 9880177097

if(category==‘S’)
{
marks = marks+bonus_marks;
}
printf(“%d”, marks);
Write a C program to read percentage of marks, and print result “PASS” if percentage > or
equal to 40 or “FAIL” if percentage <40.
/*prg to print result*/
#include<stdio.h>
float percent;
main()
{
printf(“enter the percentage”);
scanf(“%f”,&percent);
if(percent>=40.0)
printf(“Pass”);
if(percent<40.0)
printf(“Fail”);
}

The if….else statement:


The if…else is a two way decision making selection statement. If the condition evaluates to true,
one set of instructions will be executed. If the condition evaluates to false, another set of
instructions will be executed. The if…else statement can be represented diagrammatically as
shown below:

Programming in C (2021-22) Unit 2 Page 11


DMSMs College of Computer Applications, Belgaum 9880177097

Syntax of the if statement


if (test expression)
{
true block statement(s);
}
else
{
false block statement(s);
}
statement-x;
• If the condition evaluates to true, one set of instructions will be executed.
• If the condition evaluates to false, another set of instructions will be executed.
Write a C program to find the largest of three numbers a, b, c and print the largest number, big.
#include<stdio.h>
int a,b,c,big;
main()
{
printf(“Enter three numbers:”);
scanf(“%d%d%d”, &a,&b,&c);
if(a>b)
big=a;
else
big=b;
if(c>big)
big=c;
printf(“The largest number is %d”, big);
}

Continued on next page……

Programming in C (2021-22) Unit 2 Page 12


DMSMs College of Computer Applications, Belgaum 9880177097

Nested if statement:
This branching statement is used when a series of decisions are involved. Nested means one inside
the other. This is also called as cascaded if statement.
If the condition is evaluated to true in the first if statement, then the condition in the
second if statement is evaluated and so on.
The flowchart and the syntax for the nested if statement is shown below.
Syntax: Flowchart:

if (test condition1)
{
if (test condition2)
{
statement-1;
}
else
{
statement-2;
}
}
else
{
statement-3;
}
statement-x;
An example of the nested if statement is explained below.
Bank announces bonus policy. A bonus of 2% of the balance is given to everyone, for any amount
of balance. A bonus of 5% is given to female account holders if balance if greater than Rs. 5000.
if (sex is female)
{
if (balance>5000)
bonus = .05*balance;
else
bonus = .02*balance;
}
else
{
bonus = 0.02*balance;
}
balance = balance + bonus;

Programming in C (2021-22) Unit 2 Page 13


DMSMs College of Computer Applications, Belgaum 9880177097

The else… if ladder:


This is a multi-way selection statement. It is similar to the logical OR operation.
• If first condition is true, then corresponding set of instructions will be executed and control
is transferred to the statement-x, skipping the rest of the ladder.
• If the condition is false, then the next condition is checked and so on.
• If all the conditions fail, the statements in the default block will be executed.
The syntax and flowchart of the else if ladder is
shown below:
if (condition1)
{
statement(s);
}
else if (condition2)
{
statement(s);
}
else if (condition3)
{
statement(s);
}
else
{
default statement(s);
}
statement-x;

The problem with the nested if.. else statement and the else.. if ladder is that the implementation
becomes complex. The more the alternatives, the more complex it becomes, sometimes even the
person who has implemented it also becomes confused.
In order to make it easier to implement multi-conditional branching, C language has the switch
statement.

Programming in C (2021-22) Unit 2 Page 14


DMSMs College of Computer Applications, Belgaum 9880177097

The switch statement:


The switch statement is also a multi-way selection statement but easier to understand and
implement when there are 3 or more than 3 alternatives
The flowchart for the switch statement is shown below:

The syntax for the switch statement is as follows:

switch(expression)
{
case label1 : statement(s);
break;
case label2 : statement(s);
break;
case label3 : statement(s);
break;
.
.
.
default: statement(s);
break;
}
The switch statement switches between the blocks based on the value of the expression. Each
block will have a value associated with it. Each block is represented using the case keyword and
the case keyword follows with the label of the block. Every block ends with a break statement.
In a switch statement, both the default block and the break statement are optional. If none of
the blocks are matched, then the statements in the default block are executed. If we remove

Programming in C (2021-22) Unit 2 Page 15


DMSMs College of Computer Applications, Belgaum 9880177097

the break statement from a particular block, all the subsequent blocks are also executed until
the next break statement is encountered.
Rules for the switch statement are as follows:
• The switch expression must be of an integer or character type.
• The case value must be an integer or character constant.
• The case value can be used only inside the switch statement.
• The break statement in switch case is not must. It is optional. If there is no break statement
found in the case, all the cases will be executed present after the matched case. It is known
as fall through the state of C switch statement.
• default label is optional. It will be executed if none of the case values match.
• Only one default is allowed. And it can be placed anywhere.
• Nesting of switch statements is allowed.
A sample program is shown below:
/*program to read marks in 6 subjects(100 marks each), calculate percentage(average) and print
result(class secured) */
#include<stdio.h>
float m1, m2, m3, m4, m5, m6;
int total, average;
main()
{
printf(“Enter marks in 6 subjects:”);
scanf(“%f%f%f%f%f%f”, &m1, &m2, &m3, &m4, &m5, &m6);
total = m1+m2+m3+m4+m5+m6;
average = total/6;
switch(average/10)
{
case 0 : ;
case 1 : ;
case 2 : ;
case 3 : printf(“Fail”);
break;
case 4 : printf(“Pass”);
break;
case 5 : printf(“Second Class”);
break;
case 6 : printf(“First Class”);
break;
case 7 : ;
case 8 : ;
case 9 : printf(“Distinction”);
break;
}
}

Programming in C (2021-22) Unit 2 Page 16


DMSMs College of Computer Applications, Belgaum 9880177097

Conditional Operator:
For conditional expressions, a ternary operator (3 operands), is used as follows

exp1 ? exp2 : exp3;

where exp1, exp2 and exp3 are expressions. exp1 is a relational expression(comparison) and is
evaluated first. If TRUE, then exp2 is evaluated or otherwise exp3 is evaluated. For eg.

a=10; b=15;

x = (a>b) ? (a-b) : (b-a);

goto statement:
All branching statements seen so far are based on some condition. The goto statement is an
unconditional branching statement.

A label has to be used with the goto statement. A label can be defined by using a name(should not be a
keyword or a variable) followed by a : (colon). Any label should be followed by a C language statement
which ends with a ; (semi-colon). The goto statement should refer to the label.

The syntax for goto is shown below.

goto label;

Somewhere in the program, the label should be used as shown below.

label: statement(s);

By using goto statement, we can

– skip some instructions and jump forward in the program or

– jump back and again repeat a set of instructions

Some examples of programs implemented using goto statements are

1. Read numbers continuously from keyboard until 999 is pressed

2. Find the factorial of a number n.

Programming in C (2021-22) Unit 2 Page 17


DMSMs College of Computer Applications, Belgaum 9880177097

Decision Making and Looping


goto statement(backward jump) allows repetition of steps in a program. goto statement does not
implement structured programming, and care has to be taken while using this for looping. There are other
convenient methods for performing looping.

Loop means a sequence of statements are executed repeatedly till some condition is satisfied.

Looping has two segments


1. Body of loop: These are the steps to be repeated a number of times.
2. Control statement: This contains the test condition to be checked in order to repeat the steps.

The test may be to


• Find whether loop has been repeated a number of times (Counter-controlled loop)
• Determine whether a particular condition has been met (Sentinel-controlled loop)

There are 4 important steps involved in looping. They are


1. Setting and initialising condition variable
2. Execution of statements in the loop
3. Test for specified value of condition variable in order to repeat loop
4. Incrementing or updating the condition variable

There are two kinds of looping. They are


1. Entry controlled loop
2. Exit controlled loop

Entry controlled loop Exit controlled loop


In this type of loop, the control conditions are Here,the control conditions are tested at the end
tested before the start of the loop. If conditions of the body of the loop. This means that the
are not satisfied, the body of the loop will not be statements in the body of loop are executed
executed. This type of loop is also called as pre- atleast once. If conditions are satisfied, the body
test loop. of the loop will be executed again and again. This
is also called as post-test loop.

Programming in C (2021-22) Unit 2 Page 18


DMSMs College of Computer Applications, Belgaum 9880177097

The different types of looping statements in C language are

1. The while statement (Entry-controlled)

2. The do statement (Exit-controlled)

3. The for statement (Entry-controlled)

The while loop


This is the simplest of all looping statements. This is an entry controlled loop – as test condition is
checked before executing the body of loop.

The syntax of the while loop statement is as follows:

while(test condition)

body of the loop

• Test condition is evaluated, if true, then the body of the loop is


executed

• Then test condition is evaluated again, if found true, the body of the
loop is repeated until the test condition becomes false

The do… while loop


This is a exit-controlled loop. The body of the loop will be executed at least
one.

The syntax of the do… while looping statement is as follows:

do

body of loop

} while(test-condition);

• The body of the do…while loop is executed first and then the
condition is evaluated.

• If the value is true, the body of the loop is executed again

• If the value is false, the execution of the body of the loop stops.

Programming in C (2021-22) Unit 2 Page 19


DMSMs College of Computer Applications, Belgaum 9880177097

The for loop


This is another entry controlled loop.

The syntax of the for loop is as follows:

for (initiliazation; test-condition; incr/decr)

body of loop

• First the counter is initialized, and then the condition is evaluated.

• If the value of the condition is true, the body of the for loop is executed. Otherwise, the body of the
loop is not executed.

• After the execution of the for loop’s body, the counter is either incremented or decremented. Then
the condition is evaluated again and so on.

The following two programs illustrate how the different loop statements can be used.

1. Program to evaluate y = xn, where n is non-negative

/* program to find y =xn*/


#include<stdio.h>
int x, n, y, i;
main()
{
printf(“Enter the values of x and n”);
scanf(“%d %d”, &x, &n);
y=x;
i = 1;
while(i<n) do for (i=1; i<n; i=i+1)
{ { {
y=y*x; y=y*x; y=y*x;
i=i+1; i=i+1; }
} }while(i<n);
printf( “The power of %d raised to %d is %d”, x, n, y);
}

2. Program to find the factorial of a number n.

/* program to find factorial of a number*/


#include<stdio.h>
int n, i=1, fact=1;
main()
{

Programming in C (2021-22) Unit 2 Page 20


DMSMs College of Computer Applications, Belgaum 9880177097

printf(“Enter the number:”);


scanf(“%d”, &n);
if (n<0)
printf(“No negative numbers allowed.”);
else
if(n==0)
printf(“The factorial of 0 is 1”);
else
{
while(i<=n) do for(i=1; i<=n; i++)
{ { {
fact=fact*i; fact=fact*i; fact=fact*i;
i=i+1; i=i+1; }
} } while(i<=n);
printf(“The factorial of %d is %d”, n, fact);
}
}

The break statement


This is an unconditional branch statement. The break statement is used inside the looping statements to
break the execution of the loop. When the break statement is encountered inside the loop, the execution
of the body of the loop stops and the control is given to the next instruction after the body of the loop.
Its syntax is as follows
loop
{
-----;
-----;
break;
-----;
}
statement;

The continue statement


The continue statement is used inside the looping statements to skip the execution of a set of instructions
and return the control back to the loop. When a continue statement is encountered within the body of the
loop, the statements after the continue statement are skipped and the control is passed back to the loop.
Its syntax is as follows.
loop
{
-----;
-----;
continue;
-----;
}
statement;

Programming in C (2021-22) Unit 2 Page 21

You might also like