M
manochavishal
HI,
I read that every char in expression is promoted to int.
So as function arguments are expressions so type promotion should take
place for arguments passed to function.
so
*****
int main(void)
{
char c = 'C';
test(c);
return 0;
}
void test(char c)
{
printf("Size of char is %d",sizeof(c));
}
*******
should print -Size of char is 4 - as the char c is promoted to type
int.
But it prints 1
Why??
Cheers
Vishal
I read that every char in expression is promoted to int.
So as function arguments are expressions so type promotion should take
place for arguments passed to function.
so
*****
int main(void)
{
char c = 'C';
test(c);
return 0;
}
void test(char c)
{
printf("Size of char is %d",sizeof(c));
}
*******
should print -Size of char is 4 - as the char c is promoted to type
int.
But it prints 1
Why??
Cheers
Vishal