ish_nalini
ish_nalini
Branch Unspecified
30 Mar 2008

squeeze ur brain

what is the o/p:

char a='a';
printf("%d %d",sizeof(a),sizeof('a'));
sristi

sristi

Branch Unspecified
12 years ago
i guesso/p will be 2 and 1since printf executes 4m left to right ..sizeof('a') =1 byte..sizeof a char and sizeof(a)=2 bytes
pad

pad

Branch Unspecified
12 years ago
ish_nalini
what is the o/p:

char a='a';
printf("%d %d",sizeof(a),sizeof('a'));

answer is architecture dependant.

sizeof (datatype) are always architecture dependant.... unless you use virtual machines like JVM.
mahul

mahul

Branch Unspecified
11 years ago
yeah pad is right this gotta depend on compiler and architecture
Yamini L

Yamini L

Branch Unspecified
10 years ago
i think it would be 2 and 1...for int 2bytes and for char 1 byte...that also depends on the architecture of ur system
ambuja 28

ambuja 28

Branch Unspecified
10 years ago
we cant write sizeof() inside printf .so it 'll give error
sattu21

sattu21

Branch Unspecified
10 years ago
the answer wud be
1 1
pallavi agarwal

pallavi agarwal

Branch Unspecified
10 years ago
according 2 me the answer wud be 1 1 & also there is no need to give char a='a' ,we can simply give char a coz thats not making any difference basically.
friendster7

friendster7

Branch Unspecified
10 years ago
the answer will be 1 and 1 too.and we can write sizeof() in printf their will be no error.

Share this content on your social channels -

Only logged in users can reply.