c program to demonstrate pointer to arrayvoid


C program to demonstrate Pointer to array:

void p2a(int *);

void main()

{

                int x=10, *a,**b;

                int arr[5];

                a=&x;//pointer to variable

                b=&a;

                printf("\n\n<<>>\n");

                printf("\nvalue of x=%d",x);

                printf("\nvalue of x using pointer(a) =%d",*a);

                printf("\nvalue of x using pointer to pointer(b) =%d\n",**b);

                printf("\naddress of x=%u",&x);

                printf("\naddress of x=%u",a);

                printf("\naddress of x=%u",*b);

                printf("\naddress of a=%u",&a);

                printf("\naddress of a=%u",b);

                printf("\naddress of b=%u",&b);

                //pointer to array

                printf("\n \n\n<<>>\n");

                for (int i=0; i<5; i++)

                {printf("\nEnter %d th element of array\t",i);

                scanf("%d",&arr[i]);

                }

                p2a(&arr[0]);

 

 

}

void p2a(int *y)

{             

                printf("\n printing array element using array\n");

                for (int i=0;i<5;i++)

                {

                                printf("\n %d",*y);

                                y++;

                }

getch();

}

 

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: c program to demonstrate pointer to arrayvoid
Reference No:- TGS0162081

Expected delivery within 24 Hours