answersLogoWhite

0


Best Answer

real value needed

A compile time error i.e ..

Error: possible loss of precision: double, required: int

None, it will converted automagically.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What error occurs when a real value is attempted to be assigned to an integer variable?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Can an float value be assigned to int variable?

Yes, an integer can be assigned as a float value.But it get stored as a float value, that is an implicit type conversion occurs during compilation.Smaller data types are convertible to larger data types.eg:float b=12;// an integer constant is assigned to a float variableprintf("%f",b);// when printing b it will print as 12.000000


Loss of precision error in java?

A loss of precision error occurs when you use a variable of a data type that holds more decimal values than the type of the variable you are converting/inserting to.


What is the difference between deadlock and a race condition?

Race ConditionsA race condition occurs when two threads access a shared variable at the same time. The first thread reads the variable, and the second thread reads the same value from the variable. Then the first thread and second thread perform their operations on the value, and they race to see which thread can write the value last to the shared variable. The value of the thread that writes its value last is preserved, because the thread is writing over the value that the previous thread wrote.DeadlocksA deadlock occurs when two threads each lock a different variable at the same time and then try to lock the variable that the other thread already locked. As a result, each thread stops executing and waits for the other thread to release the variable. Because each thread is holding the variable that the other thread wants, nothing occurs, and the threads remain deadlocked.


What is type equivalence in programming language?

Type equivalence occurs when two variables are of the same type. For example, if both variables are int (integer variables), they are of equal types. Equivalence can also occur with two different types that are compatible with each other.


Can int value be assigned to char variable?

Yes, but the results may not be what you expect, depending on the relative sizes of an int and a char (in bytes), whether they are signed or unsigned, and whether they use big-endian notation or not. By way of an example, in C++ an int is typically 4 bytes long while a char is 1 byte long. Both are signed by default. If you were to loop an integer from 0x80000000 to 0x7fffffff (-2147483648 to +2147483647) using big-endian notation and assign the value to a signed char, then the char would repeatedly cycle through the values 0 to 127, then -128 to 0. This is because the char takes on the value of the least-significant byte of the integer in big-endien notation (the bytes are effectively reversed in memory). However, if you cycle the int from 0xffffff80 to 0x7f (-128 to +127), then you get the expected behaviour (the char cycles from -128 to +127). However, if the char were unsigned, then the first loop would repeatedly cycle from 0 to 255 while the second would cycle from 128 to 255, and then from 0 to 127. Thus to get the expected behaviour, both the int and char must both be signed or both must be unsigned, and the range of values must be within the range of the smaller of the two types (which will typically be the char), and the system must either use big-endian notation (reverse notation) or must otherwise compensate for little-endian notation.

Related questions

Can an float value be assigned to int variable?

Yes, an integer can be assigned as a float value.But it get stored as a float value, that is an implicit type conversion occurs during compilation.Smaller data types are convertible to larger data types.eg:float b=12;// an integer constant is assigned to a float variableprintf("%f",b);// when printing b it will print as 12.000000


What is a dependent variable in a science experiment?

A change wich occurs because of the independent variable.


Why is it important to not change your variable in an experiment?

If you change more that one variable in an experiment, then when the result occurs, you won't know which variable caused the change.


Does Exponential decay occurs if the base of an exponential function is a positive integer?

Yes.


Which variable normally increases before precipitation occurs?

Relative Humidity


What is the degree of a variable in a monomial?

The number of times that the variable occurs as a factor in the monomial. In other words, the exponent of the variable, e.g., x² - x + 6 is 2nd degree.


What is moderating variable?

Moderation occurs when the relationship between two variable depends on a third variable. The third variable is referred to as the moderate variable or simply the moderator


What integer is a multiple of three five and seven in which no digit occurs more than once?

105


What is a variable interval schedule?

Variable-interval schedule (VI) is a reinforcement schedule in which reinforcement is provided for the first response that occurs after a variable amount of time from the last reinforcer or the start of the trial interval.


If five consecutive numbers have a sum of 360 what is the value of the greatest integer?

The value of the greatest integer is 76. This occurs when the set of five consecutive integers is all even numbers.


Which atmospheric variable usually increases before precipitation occurs?

barometric


What is mode of a set?

If referring to a set of individual integers, the mode would be the integer which occurs most often.