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

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



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







void p2a(int *y)


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

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


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






Posted Date: 9/29/2012 7:06:44 AM | Location : United States

Related Discussions:- C program to demonstrate pointer to array, Assignment Help, Ask Question on C program to demonstrate pointer to array, Get Answer, Expert's Help, C program to demonstrate pointer to array Discussions

Write discussion on C program to demonstrate pointer to array
Your posts are moderated
Related Questions
The car’s measurements are illustrated, using two arrays. Array 1 = {L, R, L, R, R, L, R, R, L, R, R, L, R, L, L, R, Z}

This problem familiarizes you with using random numbers in C++. The program is to compute a good approximation of p using a simulation method called "Monte Carlo". The following fi

Study the given class specification and answer the questions that follow: class Person { private:   string name;   int yrBorn;   int yrDied;   public:   Per

color representation 0,1,2,3,4,5,6,7...

A Padovan string P(n) for a natural number n is defined as: P(0) = ‘X’ P(1) = ‘Y’ P(2) = ‘Z’ P(n) = P(n-2) + P(n-3), n>2 where + denotes string concatenation. For a string of t

Luminous Jewels - The Polishing Game Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various lum

There are two ways for initializes in C++ as shown in the example that follows. The first way uses the traditional C notation. The second way uses constructor notation. int foo

C Program to copy the contents of a file: void main()    {   ifstream fin("input.txt");   ofstream fout("output.txt");   char ch;   while (fin)       {

Implement a menu driven real estate catalogue system that allows users to perform various catalogue maintenance and search tasks.  You are only allowed to use the C programming la

print this pattern 1 01 101 0101