Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

C++

ryancox5683ryancox5683 Member Posts: 5
What is type conversation in C++?

Comments

  • abhi6784abhi6784 Member Posts: 6
    Hi,
    I think you want to say type conversion or more precisely type casting.
    Sometimes we need our values to be converted into other types e.g.,
    Say, we have variables of integer type
    int a= 10;
    int b= 3;
    if we divide a/b we got result in integer i.e., 3 which is not actually right as the answer should be in fraction , but as we use integer so we got integer as output. To overcome this problem we use type casting or conversion. like,
    float c = (float)a/b; //
    You can go through the complete casting tutorial and its type on the web. Here is a link for your reference:
    http://www.cplusplus.com/doc/tutorial/typecasting/

    -Abhishek Agarwal
    http://tecwing.com
Sign In or Register to comment.