Get the FREE certificate on C, C++, Java, Python, Perl, PHP, SQL, Linux & Javascript!  

CppBuzz.com
  
Home C C++ Java Python Perl PHP Spring SQL Javascript Linux

Read and display any array using pointer variable in C

You are here : Home » Solved Programs in C » Read and display any array using pointer variable in C

#include<stdio.h>

int main()
{
int no[5]; 
int *ptr;
ptr = no;
int i;

for(i = 0;i<5;i++)
{
printf("\n Enter any no :");
scanf("%d",ptr);
ptr++;
}

ptr = no;

for(i = 0;i<5;i++)
{
printf(" %d ",*ptr);
ptr++;
}

return 0;
}