Why doesn't the code "int a = 1000, b = 1000;
long int c = a * b;" work?
Answers were Sorted based on User's Feedback
Answer / larry
This won't work if int is a 16-bit size because 1000000 >
32767 (2 to the 15th - 1). It will work when int is a 32-
bit number. It will work if you cast a or b to a long.
| Is This Answer Correct ? | 5 Yes | 0 No |
Answer / thirupathi reddy katkoori
Integer range exceeds if multiply both the variables the resultant value does not to store it. Due to exceeding the int range only we have to declare it as long int and the value is store in c
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / guest
You must manually cast one of the operands to (long).
| Is This Answer Correct ? | 1 Yes | 1 No |
Answer / vikraman85
I think mostly we should avoid assigning the variables while
declaring with the variables of another datatype..
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / komal
it wont work as we have to declare the variable 'b'
again...we can not declare it like int a=10,b=3;
it has to b like int a=10;
int b=6;
| Is This Answer Correct ? | 0 Yes | 4 No |
write a program to convert a expression in polish notation (postfix) to inline (normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix
How can I call system when parameters (filenames, etc.) Of the executed command arent known until run time?
WHAT IS MAXIMUM SIZE OF AN ARRAY IN C LANGUAGE?
8 Answers Carphone Warehouse, IBM, SAS,
enum DAY { sunday, monday, tuesday }; enum EDAYS { friday, saturday, sunday }; void main() { int i =0; if( i == sunday) { printf("%d",i); } } what would be the output?
WHAT IS HIGH LEVEL LANGUAGE?
What is clrscr in c?
hi how to convert program from notepad to turboc editor can u please help me
What are static variables in c?
Why array starts with index 0
out put of printf(ā%dā,printf(ram));
What is c language & why it is used?
write a program for 4 4 3 3 3 3 2 2 2 2 2 2 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 2 2 2 2 2 2 3 3 3 3 4 4