C program to demonstrate pointer to variable, C/C++ Programming

Assignment Help:

C program to demonstrate Pointer to variable:

void p2a(int *);

void main()

{

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

                int arr[5];

                //pointer to variable

                a=&x;

                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();

}

OUT PUT

743_C program to demonstrate Pointer to variable.png


Related Discussions:- C program to demonstrate pointer to variable

Main program to test the basic operations, The Main program is slightly mor...

The Main program is slightly more complicated and you need to think about the I/O process. First of all, for most applications you do not call the low level routines GetChar and P

How to use turbo c, Sir i want to know all the basic knowledge of turbo c.

Sir i want to know all the basic knowledge of turbo c.

Purchasing code signing certificate, Purchasing Code Signing Certificate ...

Purchasing Code Signing Certificate I want to purchase a Code Signing Certificate in good standing from someone in order to sign my .EXE programs with. Please be aware I do n

Algorithms, Ask question #Minimum 100 write an algorithm to calculate simpl...

Ask question #Minimum 100 write an algorithm to calculate simple interest and compound interestwords accepted#

Maths, .Write a program to find the area under the curve y = f(x) between x...

.Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b.

Source code on home stay, I am doing project on home stay which includes fe...

I am doing project on home stay which includes features like add homestay,search,book,delete homestay,

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd