Demonstration Of Array Pointer

 #include <stdio.h>

int main(void) {

  int marks[4]={1,2,3,4};

  int*ptrarr = &marks[0];

  int*ptrarr1 = &marks[1];

  int*ptrarr2 = &marks[2];

  int*ptrarr3 = &marks[3];

  printf("location of 1st elememt in the array is = \n%p",ptrarr);

 printf("\nlocation of 1st elememt in the array is = \n%p",&marks[0]+1);

  printf("\nvalue at first position of the array is = %d ",*ptrarr) ;

 printf("\nvalue at sencod position of the array is = %d ",*ptrarr1) ;

  printf("\nvalue at third position of the array is = %d ",*ptrarr2) ;

  printf("\nvalue at fourth position of the array is = %d ",*ptrarr3) ;

  return 0;

}

🔗Link : https://replit.com/@AquaLeagen/Array-pointer-in-C?s=app

Comments

Popular Posts