Ask Question

How can I convert a number that is a double to a long?

+4
Answers (1)
  1. 18 May, 05:41
    0
    double data type contains: 8 bytes

    long data type contains: 8 bytes

    We can convert double to a long using Type casting.

    When we want to convert from one data type to another data type we use Type Casting. For example, if we want to store a lengthy value (double, long) in a integer, we can type int (data type) Variable. Using the cast operator, you can explicitly convert values from one type to another. In c language, there are two kinds of type casting that are Implicit conversions and Explicit Conversions.

    Example-

    double x = callingFunction ();

    / / Now typecast

    ing

    long y = (long) x;
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “How can I convert a number that is a double to a long? ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers