My Anna

Indias Biggest Engineering Education Community Enriching Students Minds with Latest Placement Papers, Study Materials, Fresher Jobs and Free E Books

A Unit of Aim Clear Technologies Ltd.
Search Study Materials, Jobs, Placement Papers, Interview Tips, Training Videos & More

Advertise with us

Who is online



Post new topic Reply to topic  [ 1 post ] 

neha
Marketing Executive
Marketing Executive
User avatar

Joined:
Mon Aug 24, 2009 10:57 pm
Beans: 767
In Bank: 10965
College: IET
Degree: B.E
Position: Teacher
 
#2
Tue Sep 15, 2009 5:08 pm
Post subject: Conditionals In C Language Post
Conditionals are used within the if and while constructs:

if (conditional_1)
{
...block of statements executed if conditional_1 is true...
}
else if (conditional_2)
{
...block of statements executed if conditional_2 is true...
}
else
{
...block of statements executed otherwise...
}

and any variant that derives from it, either by omitting branches or by including nested conditionals.

Conditionals are logical operations involving comparison of quantities (of the same type) using the conditional operators:

< smaller than
<= smaller than or equal to
== equal to
!= not equal to
>= greater than or equal to
> greater than

and the boolean operators

&& and
|| or
! not

Another conditional use is in the switch construct:

switch (expression)
{
case const_expression_1:
{
...block of statements...
break;
}
case const_expression_2:
{
...block of statements...
break;
}
default:
{
...block of statements..
}
}

The appropriate block of statements is executed according to the value of the expression, compared with the constant expressions in the case statement. The break statements insure that the statements in the cases following the chosen one will not be executed. If you would want to execute these statements, then you would leave out the break statements. This construct is particularly useful in handling input variables.

Profile E-mail
Offline

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 
Bookmark & Share

Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB Group.

phpBB SEO