Best C Programming code for representing array using pointer(January,2021)

#include<stdio.h>

int main()
{
    int ar[10],*ptr,m,i;

    ptr=&ar[0];

    printf("Enter the number of elements : ");
    scanf("%d",&m);

    for(i=0;i<m;i++)
    {
        scanf("%d",(ptr+i));
    }
    printf("Values are : ");
    for(i=0;i<m;i++)
    {
        printf("%d,",*(ptr+i));
    }
}

Leave a Reply