Int main(){int a; a=31&14+5*sizeof(6.4);printf("%d",a) } output=2 how????? | SoloLearn: Learn to code for FREE!

0

Int main(){int a; a=31&14+5*sizeof(6.4);printf("%d",a) } output=2 how?????

2/9/2020 7:10:27 AM

Harsh Vyas

8 Answers

New Answer

+2

About the single & it is bitwise AND operator. SoloLearn got a good intro on that subject here https://www.sololearn.com/learn/4070/?ref=app P.S. You can edit your text bro, no need to post a typo fix as another text reply : )

+1

Are you sure the output was 2? I think it's rather 22 though. * Having known the default type used for floating point literal is double, assume sizeof(double) = 8. 31 & 14 + (5 * sizeof(6.4)) 31 & 14 + (5 * 8) 31 & 14 + (40) 31 & (14 + 40) 31 & (54) Final result: 22 Dec Binary 31 00011111 54 00110110 ----------------------- & 22 00010110 I could be wrong though;

+1

It could be the book mistake I don't know but I think your explanation is right thnku

0

I got 22 for output of the code bro ... Try to run it in Code Playground, you'll see ...

0

Is this type of questions you can expect in your coding test placements

0

Didn't you say "the book mistake"? I don't know about placements, but looks common for a challenge.

0

What is single & b/w 31 and 44 means

0