Using pointers in math expressions - C Pointer

C examples for Pointer:Pointer Variable

Description

Using pointers in math expressions

Demo Code

#include <stdio.h>

int main (void)
{
    int i1, i2;/* w ww  .ja  va 2 s . c  o  m*/
    int *p1, *p2;

    i1 = 5;
    p1 = &i1;
    i2 = *p1 / 2 + 30;
    p2 = p1;

    printf("i1 = %i, i2 = %i, *p1 = %i, *p2 = %i\n", i1, i2, *p1, *p2);

    return 0;
}

Result


Related Tutorials