On what does size of data types depend?



Hi all,

I am using gcc compiler in linux.I compiled a small program
int main()
{
printf("char : %d\n",sizeof(char));
printf("unsigned char : %d\n",sizeof(unsigned char));
printf("short : %d\n",sizeof(short));
printf("unsigned short : %d\n",sizeof(unsigned short));
printf("int : %d\n",sizeof(int));
printf("unsigned int : %d\n",sizeof(unsigned int));
printf("long : %d\n",sizeof(long));
printf("unsigned long : %d\n",sizeof(unsigned long));
printf("long long : %d\n",sizeof(long long));
printf("unsigned long long : %d\n",sizeof(unsigned long
long));
}

Result was

char : 1
unsigned char : 1
short : 2
unsigned short : 2
int : 4
unsigned int : 4
long : 4
unsigned long : 4
long long : 8
unsigned long long : 8


What i want to know is what will be the effect if i use int in
place of long in applications running on linux and also on what factors
does the size of datatypes depend.

Thanks
Sunil.

.



Relevant Pages

  • Re: real newbie question on pointers
    ... This is also very old C practice, ... Below, because of sloppy braces, you have a function definition ... mac osx 10.4.11 tiger gcc compiler in terminal. ... int main ...
    (comp.lang.c.moderated)
  • Re: struct point not identified by gcc
    ... taking their distance etc. gcc compiler is not ... identifying the struct. ... int x,y,z; ... float dist ...
    (comp.lang.c)
  • real newbie question on pointers
    ... int *p,*q; ... pnfex1a.c:14: error: parse error before '}' token ... mac osx 10.4.11 tiger gcc compiler in terminal. ... have an appropriate newsgroups line in your header for your mail to be seen, ...
    (comp.lang.c.moderated)
  • Re: real newbie question on pointers
    ... int *p,*q; ... pnfex1a.c:14: error: parse error before '}' token ... mac osx 10.4.11 tiger gcc compiler in terminal. ... have an appropriate newsgroups line in your header for your mail to be seen, ...
    (comp.lang.c.moderated)
  • Re: struct point not identified by gcc
    ... taking their distance etc. gcc compiler is not ... identifying the struct. ... int x,y,z; ... Is math.sqrt() correct or just sqrt ...
    (comp.lang.c)