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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can I determine whether a machines byte order is big-endian or little-endian?

615


Explain how can I pad a string to a known length?

649


When can a far pointer be used?

586


Explain how do you override a defined macro?

579


What is a global variable in c?

587






string reverse using recursion

1805


Is int a keyword in c?

552


What is the meaning of c in c language?

592


How can you determine the size of an allocated portion of memory?

736


What is the explanation for modular programming?

681


What is a shell structure examples?

586


Explain how can I prevent another program from modifying part of a file that I am modifying?

633


Is null equal to 0 in sql?

646


What is the 'named constructor idiom'?

636


What is function prototype in c language?

608