pemo wrote:
cogno_byte wrote:
I was given a 'C' code to dry run and get the output.
Plz help me out with the output.
Int a=15,b=10;
b<<=a;
wht value would it yield?And plz if posible state the reason.
Why don't you try it?
int a=15,b=10;
printf("%d\n", b<<=a);
b <<= a
means
b = b << a
b's value is set to b's value left-shifted a bits.
==============
*Not a pedant*
==============
Your snippet will not compile, and even if you add the appropriate
things the left shift operation on an integer is very likely to
cause overflow and undefined behaviour. This is very useful when
demonstrating your nifty software to the VP for marketing, or a
prospective funder for the company, etc.
Such sloppy coding deserves an ignominous burial. Up the pedants.
--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>