Posts

Showing posts from March, 2020

Type Casting And Cast Operators in C++

              Typecasting, or type conversion, is a method of changing an entity from one data type to another. It is used in computer programming to ensure variables are correctly processed by a function. An example of typecasting is converting an integer to a string. Example:                short int my_short = -10;         int my_int = (int)my_short;             (This converts or type casts ‘short int’ my_short variable into ‘int’) There are primarily 2 types: 11)   Implicit Type Casting             This casting happens without your effort and is generally done in order to simplify coding and its execution is automatic. There are two common forms of this- numeric conversions, where two numbers of different types are use...