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

Develop a complex app, Project Description: I would like to be building ...

Project Description: I would like to be building regarding a complex mobile application build as we require the signing of an NDA. My firm in based in Montreal Canada and we are

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

Pebble merchant, there is a pebble merchant. he sells the pebbles,that are ...

there is a pebble merchant. he sells the pebbles,that are used for shining the floor.his main duty is to take the length of the room side but he sometines mistakes doing that and m

PROGRAM, TO CONVERT A NUMBER OR A DIGIT INTO ALPHABET

TO CONVERT A NUMBER OR A DIGIT INTO ALPHABET

Constructors and methods program, To complete this assignment, edit the fol...

To complete this assignment, edit the following constructors and methods: 1. public MaxPQ(Key[] keys) - change the following loop for (int k = N/2; k >= 1; k--) sink(k);

Thermodynamics, want to solve the thermodynamics problems on c language

want to solve the thermodynamics problems on c language

Write a program that simulates a simple calculation, The program reads two ...

The program reads two numbers and a character (operator). If the character is "+" then sum is displayed. If it is "-"then difference is displayed. If it is "*" then product is disp

Develop an auto-click bot, What I need is an auto-click bot. The auto-click...

What I need is an auto-click bot. The auto-click bot would ask me for a url(or it would be pre-defined too) so that it loads that specific url and click an ad automatically. This w

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