By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,421 Members | 1,127 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,421 IT Pros & Developers. It's quick & easy.

left shift operator - qsn

P: n/a
Hi,

I have an array A[10] of type short, and I want to left shift the value
in index 0 by four. I tried the following statement:

A[0] << = 4;

Unfortunately, I get the following error when I try to compile:
-- expected primary-expression before '=' token.

Any ideas/suggestions what i'm missing or doing wrong?

Thanks!

Ali

Oct 3 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
posted:
A[0] << = 4;
Get rid of the space between << and =.

A[0] <<= 4;

Beware of integer promotion when playing around with anything smaller than an
int.

--

Frederick Gotham
Oct 3 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.