[ create a new paste ] login | about

Link: http://codepad.org/gTFDYk8G    [ raw code | output | fork ]

C, pasted on May 25:
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>

int main()
{
  uint64_t const          i_read = 5;
  uint32_t const i_chapter_count = 1073741824;

  if( i_read < 5 )
    return -1;

  if( i_read < i_chapter_count * 4 )
  {
    fprintf( stderr,
      "i_chapter_count = %" PRIu32 " of size 4 does not fit inside "
      "i_read = %" PRId64, i_chapter_count, i_read );

    return -1;
  }

  fprintf( stderr, "%" PRIu32 " chapters of 4 bytes, fits inside %" PRId64 " bytes!\n",
    i_chapter_count, i_read );

  return 0;
}


Output:
1
1073741824 chapters of 4 bytes, fits inside 5 bytes!


Create a new paste based on this one


Comments: