I am trying to write a C program with a Array of 6 elements where the number of bits of the value in each element is counted and added to the sixth element of the array. Would the piece of code I have below work?
int Array[5];
int i,b,x,y;
for(i=0; i<5; i++)
{
for(b=0; b<8; b++)
{
x=Array;
y=x&1;
Array[5]=Array[5]+y;
x>>1;
}
}
int Array[5];
int i,b,x,y;
for(i=0; i<5; i++)
{
for(b=0; b<8; b++)
{
x=Array;
y=x&1;
Array[5]=Array[5]+y;
x>>1;
}
}