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..!!


Deepika D
see i want an explanation, can you help me to understand?
int a=5,b=10,d;
d=(a,b);
if d is printed the value of d is 10. I just want to know that d=(a,b); what it evaluates?
Like · Comment ·
Pavan Gupta and Savan Patel like this
Kajal Kariya
15
Like ·
Kajal Kariya
50
Like ·
Pavan Gupta
int no_name (int a,int b)/* body of statement */{ return a*b/a;}
Like ·
Hardik Mistry
My Dear The Answer Is 4..
Like ·
Hardik Mistry
My Dear The Exate Coding is :- void main() -> int a,b,c,d: -> a=5,b=10,c=++a-b; -> printf("%d",a,b,c); & Output 4 it :- a=6,b=10,c=4
Like ·
Hardik Mistry
d=b+++a; -> answer will be a=5,b=11,d=16
Like ·
Hardik Mistry
Thn write getch() & all dht...-> indicates next line
Like ·