how the size of an integer is decided?
- is it based on processor or compiler or OS?
Answers were Sorted based on User's Feedback
Answer / prashant
It depend upon What kind of machine you have (16 or 32 bit)?
If you are using 16 bit machine then int requires 2 bytes of
memory and if you are using 32 bit machine then int requires
4 bytes of memory...
| Is This Answer Correct ? | 1 Yes | 2 No |
Answer / vishal
In this case,
Processor : now if we consider size of ALU (16 bit or 32
bit) then int size get differed.
OS: in case of OS size of int varies in windows & linux.
Compiler : In case of compiler, C compiler has size of int 2
bytes while on same OS & processor Java compiler has 4 bytes
Finally conclusion is as per operation capacity of ALU,
operating systems are designed.
while in case of compiler i think they work in somewhat
upper layers so it doesn't matter with internal operation.
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / hrishikesh
I think it is decided by Os...
Because variables are assigned memory while the program is
in execution which is done by the OS,and the "MEMORY
MANAGEMENT" is one of the important services provided by the
OS which does the "memory allocation and De allocation".
So, what will be the amount of location needed to store an
int is OS dependent .
Thanks ....,,,,
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / mrutyunjay sawant
its depends upon word length of processor
| Is This Answer Correct ? | 0 Yes | 2 No |
Answer / rani
I think its compiler specific bcoz a char holds 1byte in c
where as it holds 2 bytes in java.
| Is This Answer Correct ? | 3 Yes | 8 No |
Answer / rahul
definitely os bcoz.c compiler occupies 2 bytes in windows
where as the same c compiler occupies 4 bytes in linux.
| Is This Answer Correct ? | 3 Yes | 11 No |
Answer / rajan
it's OS, I'm sure bcoz I read this answer in Programming
Interview Exposed Book.
| Is This Answer Correct ? | 1 Yes | 13 No |
printf(), scanf() these are a) library functions b) userdefined functions c) system functions d) they are not functions
what are the stoge class in C and tel the scope and life time of it?
What are logical errors and how does it differ from syntax errors?
Should a function contain a return statement if it does not return a value?
Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.
#include<stdio.h> int main(){ int i=10; int *ptr=&i; *ptr=(int *)20; printf("%d",i); return 0; } Output: 20 can anyone explain how came the output is 20
#include<stdio.h> int fun(); int i; int main() { while(i) { fun(); main(); } printf("hello \n"); return 0; } int fun() { printf("hi"); } answer is hello.how??wat is tat while(i) mean?
write a program to display all prime numbers
Explain what will the preprocessor do for a program?
the data type used for unlimited value in c and how to do this program
what is meant by c
how does a general function , that accepts an array as a parameter, "knows" the size of the array ? How should it define it parameters list ?