fork download
  1. #include <stdio.h>
  2. #include <stdint.h>
  3.  
  4. typedef struct { uint8_t arr[10]; } S_big_integer_container;
  5. void decimal_binary( S_big_integer_container bigUInt, char *output[81] );
  6.  
  7. int main(void)
  8. {
  9. S_big_integer_container biggie;
  10. uint32_t i;
  11. char oBuf[81];
  12. char *op = oBuf;
  13. for ( i=0u; i<10; i++ )
  14. {
  15. biggie.arr[i] = 0x81u;
  16. }
  17. decimal_binary(biggie, &op);
  18. printf("Big binary number: %s\n",oBuf);
  19. return 0;
  20. }
  21.  
  22. void decimal_binary( S_big_integer_container bigUInt, char *output[81] )
  23. {
  24. uint32_t i, j;
  25. uint32_t iOut = 0u;
  26. for ( i=0u; i<10u; i++ )
  27. {
  28. for ( j=0u; j<8u; j++)
  29. {
  30. char o = ( bigUInt.arr[i] & (0x80u >> j) ) ? '1' : '0';
  31. (*output)[iOut++] = o;
  32. }
  33. }
  34. (*output)[80] = '\0';
  35. }
  36.  
Success #stdin #stdout 0s 2156KB
stdin
Standard input is empty
stdout
Big binary number: 10000001100000011000000110000001100000011000000110000001100000011000000110000001