Program with Pointer
#include <stdio.h>
#include <conio.h>
void main()
{
int a[]={2,4,6,8,9};
int *i,*j;
i=&a[4];
j=(a+4);
if(i==j)
printf("Same Location");
else
printf("Not Same Location");
getch();
}
# include <stdio.h>
void main()
{
static int a[]={0,1,2,3,4};
static int *p[]={a, a+1, a+2, a+3, a+4};
int **ptr;
ptr =p;
**ptr++;
printf("%d %d %d\n", ptr-p, *ptr-a, **ptr);
*++*ptr;
printf("%d %d %d\n", ptr-p, *ptr-a, **ptr);
++**ptr;
printf("%d %d %d\n", ptr-p, *ptr-a, **ptr);
}
Comments
Post a Comment