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

What are Storage Classes in C ?

32 Answers   CTS, HP, IBM, Maharaja Whiteline, Tamil Nadu Open University TNOU, TATA, TCS, Wipro,


read an array and search an element

1 Answers  


What is exit() function?

0 Answers  


Linked list is a Linear or non linear explain if linear how it working as a non linear data structures

0 Answers  


FORMATTED INPUT/OUTPUT functions are a) scanf() and printf() b) gets() and puts() c) getchar() and putchar() d) all the above

0 Answers  






main() { static char *s[]={"black","white","yellow","voilet"}; char **ptr[]={s+3,s+2,s+1,s}, ***p; p=ptr; **++p; printf("%s",*--*++p+3); }

1 Answers  


How can I access an I o board directly?

0 Answers  


What is the difference b/w Structure & Union?

3 Answers  


we need to calculating INCOME TAX for the person. The INCOME TAX is as follows:- First $10000/- of income : 4% tax Next $10000/- of income : 8% tax Next $10000/- of income : 11.5% tax above $10, 00,00/- : 15% tax What is the Solution of this Question ?

0 Answers  


Blade logic interview question. 1st round is a written tests with 15 multiple questions from c and c++. All are simple basic question. Like int main () { Int i=65; Return printf(“%c”, i); } 2nd and 3rd round is technical interview. The position for which I was interview was core UNIX and c. Yes it is for system programming. The company has product name blade server. For their server they are creating their own command for their purpose. Example cd command. We can implement it in a c program by using the chdir() function. So the question asks related to PID, fork, pipe, shared memory, signal. Write a program in c which will act as cp command.

1 Answers   BladeLogic, Infosys,


write a c program that if the given number is prime, and their rearrangement(permute) of that number is also prime. Ex: Input is "197" is prime Output: 791,917,179 is also prime. Please any one tell me tha code for that

3 Answers  


what is the code for getting the output as * ** ***

5 Answers   Caritor,


Categories