Answer Posted / rajat bera
bool __inline is_integer(float f){
int i = f;
return (f == static_cast<float>(i));
}
int main()
{
int num=0;
double num2= 1234;
num=num2;
if(is_integer(num2))
printf("the number is int");
else
printf("the number is float");
getch();
return 0;
}
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is the right way to use errno?
What is c language in simple words?
How to throw some light on the b tree?
What is the difference between specifying a constant variable like with constant keyword and #define it? i.e what is the difference between CONSTANT FLOAT A=1.25 and #define A 1.25
What is structure packing in c?
A character flag or control mechanism that delineates one data item from another a) variable b) constant c) delimiter d) call by reference
What are the data types present in c?
What are the functions to open and close the file in c language?
What are the advantages and disadvantages of a heap?
How can I generate floating-point random numbers?
I have seen function declarations that look like this
What are examples of structures?
What is equivalent to ++i+++j?
Which of the following operators is incorrect and why? ( >=, <=, <>, ==)
Can you define which header file to include at compile time?