Hello, Karl!

On Mon, 6 Jul 1998, Karl F. Larsen wrote:

>       I have recieved many responses to my first message all saying it
>is proper for an int to have 4 bytes. So I went back to the original
>function that checks int, float, long and char. My GCC sizeof() says all
>these types use 4 byte! This just proves more fully that sizeof() is
>broken in my Linux. Here is the test program.
>
>/* prints out type sizes */
>#include <stdio.h>
>int main(void)
>{ 
>       printf("Type int has a size of %d bytes.\n", sizeof(int));
>       printf("Type long has a size of %d bytes.\n", sizeof(long));
>       printf("Type float has a size of %d bytes.\n", sizeof(float));
>       printf("Type char has a size of %d bytes.\n", sizeof(char));
>       return 0;
>}

Are you sure ?

[vps@unicorn(2)]~$ cat > test.c 
#include <stdio.h>
int main(void)
{ 
        printf("Type int has a size of %d bytes.\n", sizeof(int));
        printf("Type long has a size of %d bytes.\n", sizeof(long));
        printf("Type float has a size of %d bytes.\n", sizeof(float));
        printf("Type char has a size of %d bytes.\n", sizeof(char));
        return 0;
}
[vps@unicorn(2)]~$ gcc -o test test.c 
[vps@unicorn(2)]~$ ./test 
Type int has a size of 4 bytes.
Type long has a size of 4 bytes.
Type float has a size of 4 bytes.
Type char has a size of 1 bytes.
[vps@unicorn(2)]~$ gcc --version
2.7.2
[vps@unicorn(2)]~$

Bye.
--
Every man is as God made him, ay, and often worse.
                -- Miguel de Cervantes

--
    With best of best regards, Pawel S. Veselov (aka Black Angel)
                   Internet e-mail : [EMAIL PROTECTED]
    Web page : http://www.druid.ml.org/~vps/ | ICQ UIN : 5252265

Reply via email to