Re: Hellp with type promotion
- From: "manochavishal@xxxxxxxxx" <manochavishal@xxxxxxxxx>
- Date: 28 Feb 2006 05:47:46 -0800
Hi,
it does promote to int type.
If we dont explicitly declare the function prototype, the function
argument character is promoted to int.
void test();
int main(void)
{
int n;
char c = 'C';
test(c);
printf("\nsize in main %d",sizeof(c));
return 0;
}
void test(c)
{
printf("size in func %d",sizeof(c));
}
This prints:
size in func 4
size in main 1
So if we dont tell compiler explicitly in the prototype the type of
arguments they are promoted.
Great!!
Cheers
Vishal.
.
- Follow-Ups:
- Re: Hellp with type promotion
- From: Default User
- Re: Hellp with type promotion
- From: Robin Haigh
- Re: Hellp with type promotion
- References:
- Hellp with type promotion
- From: manochavishal@xxxxxxxxx
- Re: Hellp with type promotion
- From: Ravi Uday
- Hellp with type promotion
- Prev by Date: Re: please explain clearly what actually happens after i click on COMPILE
- Next by Date: Re: Typedef or not
- Previous by thread: Re: Hellp with type promotion
- Next by thread: Re: Hellp with type promotion
- Index(es):
Relevant Pages
|