From: Martin Ambuhl Newsgroups: comp.os.msdos.djgpp Subject: Re: How big is a SHORT? Date: Sat, 16 Oct 1999 12:32:02 -0400 Content-Transfer-Encoding: 7bit References: <7ua3p7$nlt$2 AT news8 DOT svr DOT pol DOT co DOT uk> X-Posted-Path-Was: not-for-mail X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-ELN-Date: 16 Oct 1999 16:29:51 GMT X-ELN-Insert-Date: Sat Oct 16 09:35:07 1999 Organization: Nocturnal Aviation Lines: 30 Mime-Version: 1.0 NNTP-Posting-Host: dialup-209.246.77.60.newyork2.level3.net Message-ID: <3808A882.474863BC@earthlink.net> X-Mailer: Mozilla 4.7 [en] (Win95; U) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hammy wrote: > > so, how many bits is it? > most books say it it the same as an int, but when I make a structures using > int and shorts, they give different results? #include #include int main(void) { printf("A short is %lu bits wides.\n", (unsigned long)CHAR_BIT*sizeof(short)); return 0; } Note that both CHAR_BIT, the number of bits in a byte or char, and sizeof(short), the size of a short in bytes, or specific to the implementation. Your "most books" are wrong. -- Martin Ambuhl mambuhl AT earthlink DOT net __________________________________________________________ Fight spam now! Get your free anti-spam service: http://www.brightmail.com