Why we use typecasting in C-language? With the hep of examples, explain the two types of typecasting.
Answers
Answered by
0
Type Casting - C Programming. Type casting refers to changing an variable of one data type into another. The compiler will automatically change one type of data into another if it makes sense. ... Casting allows you to make this type conversion explicit, or to force it when it wouldn't normally happen.
Answered by
1
The reason behind to use the type casting is as follows:
Explanation:
- Typecasting is a concept in which any variable type is changed to another type. For example, if any variable type is an integer and it needs to change the variable type in float then there is a need for typecasting.
- Suppose there is a two-variable whose type is an integer and there is a needs to perform the division operator, whose result comes in the terms of float. So the typecasting is done before doing the division operation because its result comes in the float.
- When the user does not follow the typecasting concept, then the result comes into the integer.
Learn More:
- Typecasting : https://brainly.in/question/10847540
Similar questions