There are two types of type conversion: implicit and explicit conversions. Implicit conversions are done by the compiler. If there is any implicit conversion in which bigger type is converted to smaller one and there is loss of information, compiler gives error/warning.

Explicit conversions are done by programmer using static_cast operator. static_cast operator takes type in angular braces and called with the type as shown in below example.

#include <iostream>
 
int main(int argc, char const *argv[])
{
 
    std::cout << "char to int\n";
    std::cout << static_cast<int>('A') << "\n";
 
    std::cout << "signed int to unsigned int\n";
    std::cout << static_cast<unsigned int>(-1) << "\n";
 
    std::cout << "unsigned int to signed int\n";
    std::cout << static_cast<signed int>(4294967295) << "\n";
    return 0;
}

If we notice conversion of signed int to unsigned int and other way round, if value is out of range, module wrapping happens.

References

  1. https://www.learncpp.com/cpp-tutorial/introduction-to-type-conversion-and-static_cast/