Programming Blog

This blog is about technical and programming questions and there solutions. I also cover programs that were asked in various interviews, it will help you to crack the coding round of various interviews

Saturday, 13 January 2018

Relationship between pointers and Arrays

#include<stdio.h>
#include<conio.h>
void main()
{
int arr[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
int *ptr;
int i;
clrscr();
ptr = arr;
for(i=0; i<10; i++)
{
printf("arr[%d] = %d\t *(ptr+%d) = %d\n", i, arr[i], i, *(ptr+i));
}
getch();
}

No comments:

Post a Comment