ptrdiff_t - C stddef.h

C examples for stddef.h:ptrdiff_t

Type

data type

From

<cstddef>

Description

Result of pointer subtraction

Demo Code


#include <stdio.h>
#include <stddef.h>

int main ()//from   ww  w . jav  a2 s  .com
{
  int i = 0;
  int j = 2;

  int* p1 = &i;
  int* p2 = &j;

  ptrdiff_t p = p2 - p1;

  printf ("%u\n",p);

  return 0;
}

Related Tutorials