No. The address of a float can only be assigned to a variable of type pointer to float. Any other (coerced) use is outside of the definition, implementation, and portability of the language.
Yes, with typecast, but it is entirely pointless:
float f;
char c = (char)&f;
Int: 4 bytes Float: 4 double: 8 char: 1 boolean: 1
Yes, with type-cast (but I don't see why you should): char *ptr = (char *)300;
Consult your limits.h and math.h. For char it will be -128..127 or 0.255 (signed and unsigned).
You can define a data-type called 'address': 1. typedef void *address; 2. typedef struct address { char country [32]; char state [32]; ... } address.
Use the address-of operator: char c=32; // space character std::cout<<&c<<std::endl;
Int: 4 bytes Float: 4 double: 8 char: 1 boolean: 1
float usually 4 double usually 8 long is 8 but integer, unlike double string is a pointer to a memory address containing array of chars, so it doesn't have a fixed size and a char is usually 1, but i think its 2 in java
int, but can be assigned to a short, long or char as well
Yes, with type-cast (but I don't see why you should): char *ptr = (char *)300;
int, but can be assigned to a short, long or char as well
Consult your limits.h and math.h. For char it will be -128..127 or 0.255 (signed and unsigned).
Consult your limits.h and math.h. For char it will be -128..127 or 0.255 (signed and unsigned).
Char, int, float and double.
float,int,char
You can define a data-type called 'address': 1. typedef void *address; 2. typedef struct address { char country [32]; char state [32]; ... } address.
Use the address-of operator: char c=32; // space character std::cout<<&c<<std::endl;
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