THIS IS FOR JAVA i don't know about anything about other languages yes it can be assigned
the syntax is:int (number) = (float) number
FOR EXAMPLE:
int = a;
a = (float ) 5.5;
if the (float) is not there then in Java it gives an error saying precision loss of data type
Yes, but you will lose precision. Most compilers will warn you about this unless you explicitly typecast.
double a;
float b;
b = a; // warning
b = (float) a; // no warning
No, but a double value can be assigned to a float variable. (You will lose from the precision, obviously.)
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
AnswerYes, it can. For instance, if your function returns double you can assign the function call to a variable of type double.AnswerNo, only the returned value, of course.
You can do this by creating a forwarddeclaration of the function. You can call the forward drclared function inside the main to use it.int result(float num1, float num2);intmain(void){int value = result(3.14, 2.74);return (0);}intresult(float num1, float num2){int value = 0;// function codes goes here// you can alter the value of variable 'value'return (value);}The returning value of the 'result()' function is assigned to variable 'value' in 'main()'.
Default initial value of extern integral type variable is zero otherwise null.
real value neededA compile time error i.e ..Error: possible loss of precision: double, required: intNone, it will converted automagically.
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
When assigning a literal value, such as 5.628, to a float variable, you can avoid the decimal truncation warning by either using the float form of the constant (float var = 5.628f), typecasting the assignment (float var = (float) 5.628), or by making the variable double (double var = 5.628).
AnswerYes, it can. For instance, if your function returns double you can assign the function call to a variable of type double.AnswerNo, only the returned value, of course.
You can do this by creating a forwarddeclaration of the function. You can call the forward drclared function inside the main to use it.int result(float num1, float num2);intmain(void){int value = result(3.14, 2.74);return (0);}intresult(float num1, float num2){int value = 0;// function codes goes here// you can alter the value of variable 'value'return (value);}The returning value of the 'result()' function is assigned to variable 'value' in 'main()'.
Variable
Just type declare then the variable that you desire to assigned a certain constant value on it. Just type declare then the variable that you desire to assigned a certain constant value on it.
3x+2 x is a variable. A variable is a symbol (x, y, etc...) that does not have an assigned value.
The definition of constant variable is a variable whose value cannot be changed once it has been assigned a value for an experiment. It is the variable held steady, or constant, for a specific experiment.
"real" numbers, in any programming language, are actually approximations of what is called a "real number" in math. Basically, a number that can handle decimals - but unlike the actual real numbers, of limited precision. In Java, the "real" data types are float, and double. double has greater precision. A "constant" in Java is similar to a variable, but its value can't be changed after it has been assigned a value.
A constant.
float myVariable = 20.1234;
None. A letter has no numerical value unless it represents a variable and a value is assigned to it.