473,387 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

left shift operator - qsn

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
1 1908
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

43
by: Mehta Shailendrakumar | last post by:
Hello, Can anyone suggest me operator to perform arithmetic shift in C? May it be for a perticular compiler. Thank you in advance. Regards, Shailendra
4
by: Kevin | last post by:
I was looking through some source code and noticed the used of the C# << operator. Why is this being used here and under what circumstances is an left-shift operator useful. internal enum...
11
by: Kenneth Lantrip | last post by:
Anyone got any ideas as to how this process could be improved for speed? this is what I have... Dim j, q As Integer Dim x(16), y(16) As Byte x.CopyTo(y, 0) ' shift left circular 24 bits
19
by: aurgathor | last post by:
I use BC 5.02 (long is 32 bit) and I wonder if there's any efficient code that would allow me to left shift 64 bit values that I currently use this way: typedef struct { unsigned long lsLong;...
4
by: sandhya | last post by:
Hello Folks, i hava a problem in coding of circular left shift of 25 bits in my program...how do i perform it, and how do i use unsigned in VB. My program (IDEA algorithm implementation in VB) ...
56
by: Christian Christmann | last post by:
Hi, in the header of my class I've a constant static const int a = ( 1 << 32 ) - 1; When compiling the code, g++ issues the warning "warning: left shift count >= width of type" Why? And...
9
by: yuyang08 | last post by:
Dear all, Is there a logic shift operator in C++? I tried ">>", it is an arithmetic shift operator. Thanks! -Andy
24
by: Nishu | last post by:
Hi All, Could you please explain whether C standard supports logical right shift operation using some operator? I know somewhere I read about >>operator. I thought, it is in C but i think i'm...
16
by: Santosh Nayak | last post by:
Hi, Is there any way to catch the losing bit occurring due to Right Shift Operator ? e.g int a = 5 ; a = a >1 ; // // a is now 2 and the least significant bit is lost // // I want this...
4
by: G Iveco | last post by:
I am using this type of code to do right-shifting, B = 3; data1 = (data + (1 << (B-1))) >B; data1 seems incorrect when data = -4-8*i.. which means it rounds -1.5 to -1 instead of -2. On...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.