www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/01/03:58:51

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: # bits in int,char, long, shrttt
Date: Wed, 30 Apr 1997 19:28:11 +0000
Organization: Two pounds of chaos and a pinch of salt
Lines: 34
Message-ID: <33679D4B.3E02@cs.com>
References: <5k81fu$jah$1 AT d2 DOT tufts DOT edu>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp213.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Brett J. Wiesner wrote:
> 
> could someone tell me how many bits there are in each of these:
> int
> long
> char
> short
> long long
> 
> under djgpp of course. im using a pentium if it matters.

How about this:  write a program that prints the size of all the types:

#include <stdio.h>

int main( void )
{
    printf( "char = %lu\n", sizeof(char) );
    printf( "short = %lu\n", sizeof(short) );
    /* etc. */
    return 0;
}

I did exactly that when I wanted to test the type sizes under djgpp. 
The great thing about such a program is that it can be reused with any
compiler.

-- 
---------------------------------------------------------------------
| John M. Aldrich, aka Fighteer I  |     mailto:fighteer AT cs DOT com     |
| "Starting flamewars since 1993"  |   http://www.cs.com/fighteer   |
|  *** NOTICE ***  This .signature is generated randomly.           |
|                  If you don't like it, sue my computer.           |
---------------------------------------------------------------------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019