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



how the size of an integer is decided? - is it based on processor or compiler or OS?..

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

how the size of an integer is decided? - is it based on processor or compiler or OS?..

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

how the size of an integer is decided? - is it based on processor or compiler or OS?..

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

how the size of an integer is decided? - is it based on processor or compiler or OS?..

Answer / mrutyunjay sawant

its depends upon word length of processor

Is This Answer Correct ?    0 Yes 2 No

how the size of an integer is decided? - is it based on processor or compiler or OS?..

Answer / hi

processor

Is This Answer Correct ?    13 Yes 16 No

how the size of an integer is decided? - is it based on processor or compiler or OS?..

Answer / hi

os

Is This Answer Correct ?    9 Yes 14 No

how the size of an integer is decided? - is it based on processor or compiler or OS?..

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

how the size of an integer is decided? - is it based on processor or compiler or OS?..

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

how the size of an integer is decided? - is it based on processor or compiler or OS?..

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

Post New Answer

More C Interview Questions

plz answer.... write a program that reads line (using getline) e.g."345", converts each line to an integer using "atoi" and computes the average of all the numbers read. also compute the standard deviation.

1 Answers  


write a program to generate address labels using structures?

0 Answers   SJC,


7-Given an index k, return the kth row of the Pascal's triangle. For example, when k = 3, the row is [1,3,3,1]. For reference look at the following standard pascal’s triangle.

0 Answers  


What is assert and when would I use it?

0 Answers  


What is selection sort in c?

0 Answers  






In which header file is the null macro defined?

0 Answers  


how to write a cprogram yo get output in the form * *** ***** ******* ********* ******* ***** *** *

3 Answers  


main() { int a,b; printf("%d,%d",scanf("%d%d",&a,&b)); } => do u mean above program's output... =>output will be:2,whatever you enter value for b. =>because scanf is a library fn which will return how many arguements it processes, and second value you are right mr.Satya but i found my self unable to understand that for the first time scanf returns the no of successful matches but how for the second time it returns the value of 'b'.while a function should return the same 'r' value every time.

1 Answers   Cisco,


What is a list in c?

0 Answers  


how to find the size of the data type like int,float without using the sizeof operator?

13 Answers  


Write a program to know whether the input number is an armstrong number.

0 Answers   Wipro,


what is link list?

3 Answers  


Categories