What will this program print? - C Pointer

C examples for Pointer:Pointer Variable

Description

What will this program print?

Demo Code

#include <stdio.h> 
int main(void) 
{ 
   int ref[] = {8, 4, 0, 2}; 
   int *ptr; /*from  w w  w .  j a  v  a 2 s .co m*/
   int index; 
                       
   for (index = 0, ptr = ref; index < 4; index++, ptr++) 
      printf("%d %d\n", ref[index], *ptr); 
   return 0; 
}

Result


Related Tutorials