Posted by MindBreaker at 2:18 PM
Read our previous post
Intililize an integer array of 5 element .display values of all element
along with their addresses using pointer?
along with their addresses using pointer?
#include <iostream>
using namespace std;
void
main()
{
int
Array[] = {1,2,3,4,5};
int * ptr
= Array; // Taking the address of first element in
pointer;
for(int loop = 0; loop < 5; loop ++)
{
cout << "Address of element no # " <<loop
+ 1 << ptr << "--------------"
<< " Value Is: "<<
*ptr << endl;
ptr ++;
}
}
Output
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.