Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. int binary[8];
  2. char array;
  3.  
  4. for (i=0;i<8;i++)
  5. if(binary[i])
  6. "Here I want put 1 in the position bit of the variable array"
  7. else
  8. "Here I want put 0 in the position bit of the variable array"
  9.  
  10. int binary[8];
  11. char array = 0;
  12.  
  13. int n = 8;
  14. while (n) {
  15. array |= binary[--n];
  16. array <<= 1;
  17. }
  18.  
  19. for (int i = 0; i < 8; i++)
  20. array |= binary[i] << i;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement