Contact Learn C
Copy

Program 192: To Print values in array by incementing Pointer

Program 192:
 
#include<stdio.h>
main()
{
  int i,*ptr,max;
  printf("Enter number of values\n");
  scanf("%d",&max);
  int num[max];
  printf("Enter values for array\n");
  for(i=0;i<max;i++)
  {
   scanf("%d",&num[i]); 
  }
  
  ptr=&num[0];//you can also write ptr=num both are same
  
  printf("Values printed by incrementing pointer\n");
  for(i=0;i<max;i++)
  {
   printf("%d\n",*ptr);
   ptr++;
  }
  
  
}


Explanation:

//Coming Soon...

Output:

print values in array by incementing Pointer







 
Donate

Download App and Learn when ever you want

Get it on PlayStore
Get it on Amazon App Store
Get it on Aptoide