**Type Conversion in C**

The process of changing one information sort into another data type is thought as type conversion.

The automatic conversion of 1 information sort into another data type is thought as implicit type conversion. it’s done by the compiler.

The type conversion may be done manually. the kind conversion done by the computer programmer is thought as express type conversion.

We will discuss these 2 sorts very well in our next tutorials.

It is quite common that we’ve got to use each number and float numbers. whereas performing some arithmetic operations between them we must always watch out of anew things that we’ll discuss during this tutorial.

mathematical process between number associated integer can forever end in an integer.

**mathematical process between float and float can forever offer float range.**

mathematical process between float and number can forever offer float number. during this case, 1st number is going to be promoted to float then the mathematical process can present itself.

**Check out the table below to grasp these operations.**

**Type Conversion in Assignments**

It is very often that the variable on the manus facet of the assignment operator (=) doesn’t match the kind of variable on its hand side. In such a case, the worth of the full expression is going to be promoted or demoted on the idea of variable gift on manus facet of the assignment operator.

To make things a touch a lot of clear let’s take an associate example.

float a;

int b;

b=4.2;

a=3;

In the on top of example, we tend to are attempting to store the float worth (4.2) in number variable b. that the worth is going to be demoted to (4) and it’ll store within the number variable.

The same factor can happen with three. As three is an associate number, therefore it’ll be reborn to float (3.00000) then it’ll be kept in a float variable.

The complexity of the mathematical process doesn’t matter. you must stick to the 3 basic rules. That’s it.

To understand things higher. Check out below examples.

**Precedence (Hierarchy) of Operators in C**

BODMAS is that the basic rule to unravel complicated arithmetic issues in maths. sadly BODMAS doesn’t add C.

Suppose you wrote one expression.

x*y+z*a

So however you may solve this expression?

This way (x*y)+(z*a)

Or this fashion x*(y+z)*a

To solve this downside in C you’ve got to be told regarding hierarchy or precedence of operators. Hierarchy of some common arithmetic operators is given below.

**Some fast Tips**

Within nested parentheses, arithmetic operations are going to be done consistent with on top of priority. Expression underneath innermost parentheses is going to be resolved 1st.

It is suggested to use parenthesis within the program fastidiously. you must sort each parentheses 1st ( ). then begin writing expression within it. this can take away the errors caused by uncomprehensible parenthesis.

** Associativity of Operators in C**

Associativity of operators is employed once 2 operators of equal priority make a tie. therein case the mathematical process is resolved mistreatment the associativity table of C language.

Complete table of precedence and associativity of operators in C is given below.