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

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

}

 

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
THIS PROGRAM IS TO ADD THE TWO COMPLEX NO.S GIVEN BY THE USER  */ #include #include #include struct complex     {     int real;     int imag;     }; void main()  {  clrs

#write a multilevel c++ program to take marks of 3 subjects and calculate percentage and display it


program to find if a no . is prime or not

what is oops

I have a C++ programming assignment due on 8th January. As I am out of country and cannot complete it, I would like to know how much fees would you charge to complete the assignmen

We need an E Commerce site likefifacointrader. you must have experience with that kind of work You have to show a sample of work like that site. Skills required are C Prog

luminous jewel polishing necklace, c/c++ programming

There are 25 employees in a business. Each employee has 5 sales each day of the month (Assume there are 30 days in each month of the year). Draw a flowchart for a pr

Compound Assignment Operators Apart from the binary and the unary arithmetic operators, we also have compound assignment operators. These are +=, -=, *=, /=, %=. Using these op