pointer subtraction
#include <stdio.h>
int main(){
int a[]={3,5,6};
int * ptr1=&a[0];
int * ptr2=&a[1];
printf("The value of ptr1 is: %u\n",ptr1);
printf("The value of ptr2 is: %u\n",ptr2);
printf("The difference of ptr2 and ptr1 is %u\n", ptr2-ptr1);
return 0;
}
Comments
Post a Comment