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 is what I need help with. "Create a program creates an interface allowing the user to select from some other programs I have made one being a money converter and the other ca

Create a C language code, only one program, to implement the following task. Task: Write C code for a program that implements a digital clock (HH:MM:SS). The clock inclu

Describe what is actual arguments? - When certain functions are created and used to perform an action on some provided values, some values are required to be passed to them. Th

simple shopping cart

create a flowchart that display the assume that there are 3 section each student ?

Described multiple inheritance(virtual inheritance)? And explain its advantages and disadvantages? A: It is the procedure in which a child can be derived from more than one pare

Project Description: Not just like that though. I want a similar program that can scan through poker lobbys (pokerstars, full tilt, ongame and ipoker) and seat me to the left of

Constructors and Destructors: A Class is defined as constructor by declaring a constructor in the form of function inside the class.  In other word a function in the name of

#questio#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