Hi guys/gals,
I want to get the m/c size i.e., whether it is 16/32/64 bits. Is there any function in C to get the above information. I'm using Turbo C on DOS.
Regards,
Aamir
Hi guys/gals,
I want to get the m/c size i.e., whether it is 16/32/64 bits. Is there any function in C to get the above information. I'm using Turbo C on DOS.
Regards,
Aamir
What exactly is the "m/c"? Since you're using Turbo C, an int will be 16 bits. If you're trying to find the size of a variable type, you use the sizeof operator.
Otherwise, you'll need to specify exactly what you're talking about.Code:printf("The size of an int is %d.\n", sizeof( int ) );
PS: Get a new compiler.
Quzah.
Hope is the first step on the road to disappointment.
i want to get the machine (i.e., Processor) size.
> i want to get the machine (i.e., Processor) size.
About 3" square, using a ruler.
Seriously, you're not going to work out the word size of a new processor using an old fossil of a compiler like that.
Not that a new compiler would help. You can only assume that the compiler writer has chosen a word size which is "optimal" for the machine it is running on, but there's no guarantee of that.
sizeof(int) is about the best you can do, but if you persist in using some old compiler, then your anwer is already wrong.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.