I see many different answers to this question and have looked at many of them yet I cannot find the answer to my problem.
The error im getting is
bitarray.c:27:19: error: lvalue required as left operand of assignment
(newArr << i) ^= 1;
Any ideas? Thanks
newArr = (newArr << i) ^ 1
? If you clarify what you want, you will probably solve your own problem.