Array
and pointers are the two parts of C language. Array stores all the elements on
the continuous location where as pointers stores the address of a variable. We
can access elements of an array one by one by using its index number. When we
store the address of an array in a pointer only the first element address
should be stored. That is called the basic address because a pointer always
stored the basic address. If we got the basic address of an array then if we
increment the pointer by one then it find the next element of an array. A
pointer size can always be 2 byte because it stores address.
main()
{
int
a[10],*p,I;
*p=a[0];
printf("Enter
the elements of an array ");
for(i=0;i<10;i++)
scanf("%d",p+i);
for(i=0;i<10;i++)
printf("%d",*(p+i));
getch();
}
No comments:
Post a Comment