C Expressions

Contents

  • Arithmetic Expressions
  • Evaluation of Expressions
  • Precedence in Arithmetic Operators
  • Rules for evaluation of expression
  • Type conversions in expressions
  • Implicit type conversion
  • Explicit Conversion
  • Operator precedence


Arithmetic Expressions

	main ()
	{ 
	    float a, b, c x, y, z;
	    a = 9;
		b = 12; 
		c = 3; 
		x = a – b / 3 + c * 2 – 1; 
		y = a – b / (3 + c) * (2 – 1); 
		z = a – ( b / (3 + c) * 2) – 1; 
		printf (“x = %fn”,x); 
		printf (“y = %fn”,y); 
		printf (“z = %fn”,z); 
	}
An expression is a combination of variables constants and operators written according to the syntax of C language.

	Algebraic 		               C Expression
	Expression
	a x b – c 				a * b – c
	(m + n) (x + y)			       (m + n) * (x + y)
	(ab / c)				a * b / c
	3x2 +2x + 1				3*x*x+2*x+1
	(x / y) + c				x / y + c 
 

Make Comments..!!



Please Make some Posts.

If you are New User,Sign-Up Required.It will not take more than 3 Minutes.For existing users,Please click Login Button!!