SICKENING, SIRS, SICKENING AN INT TAKES THE SAME AMOUNT OF MEMORY AS A LONG!!
YOU CAN TEST IT YOURSELF !!
WARNING:THIS WILL DISGUST YOU
#include <stdio.h>
#include <stdlib.h>
int main()
{
char c;
int i;
long l;
printf( "A char is this big: %d\n", sizeof(c) );
printf( "An int is this big: %d\n", sizeof(i) );
printf( "A long is this big: %d\n", sizeof(l) );
}
Name:
Anonymous2008-02-05 9:08
You should use %u instead of %d
Name:
Anonymous2008-02-05 9:14
You should read SICP
Name:
Anonymous2008-02-05 9:21
aaaa what did you do to my computer?
Name:
Anonymous2008-02-05 9:22
Does printf support BBCode?
Name:
Anonymous2008-02-05 10:01
This is platform specific. A long can be bigger than an int
Name:
Anonymous2008-02-05 10:01
SERIOUS FUCKING DISCUSSION HERE GUYS
Name:
Anonymous2008-02-05 10:06
>>6
I'm on a Slackware derivative!! Why is this happening to me!?
Name:
Anonymous2008-02-05 10:09
I think it's more influenced by hardware. On a 32bit x86, ints are probably 32 bits. The c standard only makes a guarantee something like that short is less than long, and that int is >= short and <= long or something
Name:
Anonymous2008-02-05 10:16
<=>
Name:
Anonymous2008-02-05 10:16
When I wrote an ANSI C compiler, it had longs longer than ints.
Name:
Anonymous2008-02-05 10:36
% ./a.out
A char is this big: 1
An int is this big: 4
A long is this big: 8
whut
Use Arch Linux.
Name:
Anonymous2008-02-05 11:33
From the C90 standard:
5.2.4.5.1 Sizes of integral types <limits.h>
The values given below shall be replaced by constant expressions suitable for use in #if preprocessing directives. Moreover, except for CHAR_BIT and MB_LEN_MAX, the following shall be replaced by expressions that have the same type as would an expression that is an object of the corresponding type converted according to the integral promotions. Their implementation-defined values shall be equal or greater in magnitude (absolute value) to those shown, with the same sign.
[...]
-- minimum value for an object of type int INT_MIN -32767
-- maximum value for an object of type int INT_MIN +32767
[...]
-- minimum value for an object of type long int LONG_MIN -2147483647
-- maximum value for an object of type long int LONG_MIN +2147483647
Name:
Anonymous2008-02-05 11:34
>>13
In other words, ints are at least two bytes, longs are at least four bytes, and both can be longer than that depending on your implementation.
>>14 WRONG. ints are at least 16 bits wide, longs are at least 32 bits wide. The size of a `byte´ is given by CHAR_BIT, which is at least 8 (but can be more).
Also, sizeof does not yield an int, so %d is wrong. The correct formatting specifier is %zu.
Name:
Anonymous2008-02-05 12:45
nigger[~]$ ./sizeof
A char is this big: 1
An int is this big: 4
A short is this big: 2
A long is this big: 4
Name:
Anonymous2008-02-05 12:50
A char is this big: -3
An int is this big: |--------|
A SICP is this big: 9?2¤#@brntszfa42{%NO CARRID I CAN'T DO THAT, DADAISY, GIVE Me your aaanswrdOoooo .
Name:
Anonymous2008-02-05 13:02
GRAPHICAL FAGGOTRY
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i;
i = sizeof(char);
printf( "A char is this big: |" );
while( i > 0)
{
printf( "-" );
--i;
}
printf( "|\n" );
i = sizeof(int);
printf( "An int is this big: |" );
while( i > 0)
{
printf( "-" );
--i;
}
printf( "|\n" );
i = sizeof(short);
printf( "A short is this big: |" );
while( i > 0)
{
printf( "-" );
--i;
}
printf( "|\n" );
i = sizeof(long);
printf( "A long is this big: |" );
while( i > 0)
{
printf( "-" );
--i;
}
printf( "|\n" );
return 0;
}
Name:
Anonymous2008-02-05 13:05
Use for(i = sizeof(char); i > 0; i--)
printf("-");
Name:
Anonymous2008-02-05 13:09
>>19
Good Sir, I say, graphicalities are the least of your faggotry.
>>32
no shit, the size of char is always 1.
Did yo,u think this much faggot? are you sure you weren't trying to say 'types/objects in C have to have positive sizes?'