Search⌘ K

Type casting

Explore how to convert data types using type casting in C programming. Understand implicit and explicit type casting, see practical examples, and learn best practices to prevent data loss by casting from smaller to larger types.

What is type casting?


Type casting is a special kind of operator that converts one datatype to another.


It is a unary operator, and its basic syntax is given below:

(type) (expression);

Types

There are two types of typecasting:

  • Implicit type casting
  • Explicit type casting
...