Previous: Reading and writing blocks, Up: Blocks   [Index]


8.2.3 Example programs for blocks

The following program shows how to allocate a block,

#include <stdio.h>
#include <gsl/gsl_block.h>

int
main (void)
{
  gsl_block * b = gsl_block_alloc (100);
  
  printf ("length of block = %u\n", b->size);
  printf ("block data address = %#x\n", b->data);

  gsl_block_free (b);
  return 0;
}

Here is the output from the program,

length of block = 100
block data address = 0x804b0d8