The & and * Pointer Operators - C Pointer

C examples for Pointer:Introduction

Introduction

& gets the address of a variable while * defines a pointer type.

The following program uses * and & operators to put the value 10 into a variable called target.

This program displays the value 10 on the screen.

Demo Code

#include <stdio.h>

int main(void)
{
   int target, source;
   int *m;/*  w  w  w . j  a v a  2  s.  c  o  m*/

   source = 10;
   m = &source;
   target = *m;

   printf("%d", target);

   return 0;
}

Result


Related Tutorials