Pointer addition - C Pointer

C examples for Pointer:Pointer Variable

Description

Pointer addition

Demo Code

#include <stdio.h>
#define SIZE 4/*from  w  w w  .  j  a va  2 s . c  o  m*/
int main(void)
{
    short dates [SIZE];
    short * pti;
    short index;
    double bills[SIZE];
    double * ptf;
    
    pti = dates;    // assign address of array to pointer
    ptf = bills;
    printf("%23s %15s\n", "short", "double");
    for (index = 0; index < SIZE; index ++){
        printf("pointers + %d: %10p %10p\n", index, pti + index, ptf + index);
    }
    return 0;
}

Result


Related Tutorials