+ 1
how does the pc know the size of int is 4. Is there any formula?
without using the help of pc ofcourse
8 Respuestas
+ 1
Well for c and c++, the compiler is platform dependant, in order to make the language platform independent. This means you need to write a separate compiler for x86, amd64, arm, etc. The compiler will have the base type sizes (int) hard coded into it. Derived types like size_t will be converted to real types (unsigned int, etc), structs and unions will be calculated based on the types they contain.
+ 1
ok so is it inbuilt??
0
please explain
0
when you type sizeof(int) in pc it will give 4
0
how does it do it??
0
This depends on your processor as well as compiler.If you have 16 bit computer then sizeof (int)=2 and if you have 32 bit computer then sizeof(int)=4.Hope you got😊
0
Amod T V Yes.