Dear Friend,
Please view the following question.
Which one of the following statements is the shortest statement that will prevent integer overflow corruption in the result?
Choice 1 long c=(long)a*(long )b; ( is not the answer).
Choice 2 long c=(long)a*b;
Choice 3 long c=a*b;
Choice 4 long int c=a*b; [Ans]
Choice 5 long c=(long)(a*b);
But I don't how this is said as correct answer.
I tried to find answer of this question, I found that 1 option is not the answer.
Kindly say which is answer and why and how....
Thanks in advance.
Regards,
Salvi
Please view the following question.
Which one of the following statements is the shortest statement that will prevent integer overflow corruption in the result?
Choice 1 long c=(long)a*(long )b; ( is not the answer).
Choice 2 long c=(long)a*b;
Choice 3 long c=a*b;
Choice 4 long int c=a*b; [Ans]
Choice 5 long c=(long)(a*b);
But I don't how this is said as correct answer.
I tried to find answer of this question, I found that 1 option is not the answer.
Kindly say which is answer and why and how....
Thanks in advance.
Regards,
Salvi
Comment