Which of the following typecasting is accepted by C language?
a) Implicit typecasting
b) Explicit typecasting
c) Both implicit and explicit typecasting
d) None of the above
Answer:
c) Both implicit and explicit typecasting
Explanation:
C supports both implicit and explicit typecasting. Implicit typecasting occurs automatically when a value is converted to a different data type by the compiler, usually from a smaller to a larger data type. Explicit typecasting is performed manually by the programmer using the cast operator. For example, (float)int_var
converts an integer variable to a float.
Understanding typecasting is essential for managing data types correctly and avoiding unexpected behavior in C programs.