Saturday, May 10, 2008

Expression

Expression

Evaluation of expression

An expression is a combination of variables, constants
and operators arranged according to the syntax of the language.

C can handle any complex expression with ease.

It is little bit different from algebraic expression.

Algebraic Expressions C Expressions
axb-cxd a*b-c*d
(m+n)(a+b) (m+n)*(a+b)


Evaluation of expression:

We can evaluate an expression by using assignment statement. As

Variable = Expression.

e.g. :

Temp = ((f * cos(x)/sin (y))+(g * sin(x)/cos(y)))

All relevant variables must be assigned values
before the evaluation of the expression.

Type conversion in expression:

To effectively develop C programs, it would be necessary
for you to understand the rules that are used for the
implicit conversion of operands.

If an expression contains an operation between an int
and a float, the int would be automatically promoted to
a float before carrying out of operation.

0 comments:

Copyright

Copyright © 2008 C Tutorial, All rights are reserved