A. Typecasting issue in C++ C++ code of type casting, which is considered as an insecured code. The same problem occurred in Ariane 5, which ended up in a crash. According to (Soulie, 2007) , Type casting is known as converting an expression of a given type into another type. In C, type converstion can be done using, 1. Implicit Convertion – one type of data is automatically converted into compatible type of data. 2. Explicit Convertion – Many conversions, specially thos that imply a different interpreation of the value. It has 4 specific casting operators (dynamic_cast, reinterpret_cast, static_cast and const_cast). Here, the conversion truncates, that is the fractional part is discared. There is a data loss, since the out put is 13, expected output was 14. Remedy – Use static_cast and add 0.5 before casting. c = static_ca...
Risky, yet worthy point to cover at times. Certainly, not as awesome or as awful as you think.