answersLogoWhite

0


Best Answer

No, but a typecast can:

int n;

double d;

d= (double)n;

User Avatar

Wiki User

15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Can a union be used in c to convert an integer into a double?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is a function used to convert ASCII to integer?

atoi


What is parseint in javascript?

it is used to convert the string value that we get from the users to integer data type


How do you convert integer to objects in c?

There are no objects in C, so you can't. However, in C++ you can convert an integer to an object if the object's class exposes a public conversion constructor that accepts an integer argument. For example: class X { public: X (int); // conversion constructor // ... }; How the conversion is implemented depends on the class designer. In the following example, a user can construct a complex number type from an integer: class complex { private: double r; double i; public: complex (double real, double imaginary): r {real}, i {imaginary} {} complex (int real): r {real}, i {0.0} {} // ... }; Here, the implementation implicitly converts the integer to a double and assigns that value to the real representation and assigns the value 0.00 to the imaginary representation. This class may be used as follows: complex c = 42; // e.g., c.r = 42.0, c.i = 0.0 If a conversion constructor is provided, a corresponding conversion assignment is usually provided as well: class complex { private: double r; double i; public: complex (double real, double imaginary): r {real}, i {imaginary} {} complex (int real): r {real}, i {0.0} {} complex& operator= (int real) { r = real; i = 0.0; } // ... }; This class may be used as follows: complex c {1.1, -3.14}; // ... c = 42; // e.g., c.r = 42.0, c.i = 0.0


Difference between array and union?

All the members of the structure can be accessed at once,where as in an union only one member can be used at a time. Another important difference is in the size allocated to a structure and an union. for eg: struct example { int integer; float floating_numbers; } the size allocated here is sizeof(int)+sizeof(float); where as in an union union example { int integer; float floating_numbers; } size allocated is the size of the highest member. so size is=sizeof(float);


What is integer in visual basic?

In the computer programming language Visual Basic, the data type integer is a whole number which can be used in calclations. It can be positive, negative, or zero. The default type of integer is 32-bit, but with "short" and "long" you can have 16- or 64- bit answers. The short data type works well with small numbers and saves RAM space. If overflow is a problem, long works better because of its larger capacity. To take the integer portion of a decimal, single, or double, use the int() function. int(3.925604) returns 3 as a decimal To convert a data type to integer, use cint() cint(int(3.925604)) returns 3 as an integer


What is mean by parse in java?

It is used to convert the value of one datatype into a value of another datatype. Example- Integer.parseInt(in.readLine); It converts given value to Integer datatype.


Why is union used in C?

Union is used in case of libraries which return assorted data's. for example, say a stack library is present which can return an int or double depending on what is on top of stack. in such a case, the application layer should be able to receive from library either int or double. so in application layer we use union.


What is an integer and how do you use it?

An integer is a whole number. These can be used in many ways like making equations.


Why we use IntegerParseInt in java?

Parsing is very important since the input from the user is not in the form of ints but in a String, therefore, you have to parse the String containing the number into a primitive data type. i.e. String num = "49"; int realNum = Integer.parseInt(num); // puts 49 into realNum;


What is a symbol used to represent a number?

exponentalso in a lower education way....TALLY MARKSLots of symbols were use to represent number like 1 2 3 4 5 ...... etc. There are also other ancient cultures that have different symbols to represent different numbers eg: Chinese culture, Japanese culture. An integer is used when a whole number is being used eg: 1 is an integer, -67 is an integer or 457455754 is an integer. 9.56 is not an integer or -7.8 is not integer. The symbol used to recognize an integer is like Z from the English Alphabet.


What is an unsigned integer?

Having an unsigned integer means that the integer is positive, and not negative; literally, the integer is unsigned and assumed to be positive. The unsigned integer 8 is positive-eight, not negative-eight.


How do you lose data assigning a real number to an integer data type?

Integers can't store fractional information. Attempting to store the number 1.5 in an integer will give you an integer with the 1 in it - this is data loss. Another example comes up when the IEEE floating point standard is used to store values. According to the IEEE 754 standard, 32 bits can be used to store decimal values up to 9.999999 x 1096. This is a full order of magnitude larger than the largest integer value that can be stored in 32 bits: 4.294967295 x 109. Attempting to convert one of these very large numbers to an integer will give incorrect results.