Programming In C, Type casting in C language

Question 1: What is the use of type casting in C language?

Ans: Typecasting is a method to convert a variable

from one data type to another data type during

program execution. It makes a variable of one type to

act line another type. For example, a variable of type

int can act as a variable of type char using

typecasting.

Typecasting in c program

For example, one use for typecasting is when there is

need to produce ASCII characters for decimal codes

(0 127). To do this, the programmer will need to use to typecast to print out the integer variable as its character equivalent using for specifier %c.

Comments

Popular posts from this blog

Conditional Control structure. Chapter 4, Lab Activities, Long questions.

Chapter # 5, Loop Control Structure, Lab Activities