0% found this document useful (0 votes)
34 views1 page

Address Manipulation

This C++ program demonstrates address manipulation in a 2D array. It declares a 3x5 integer array initialized with values from 1 to 15. It then uses pointer arithmetic on the array to access and print out various elements, such as the element after the last in the second row, the third element in the second column, and using a pointer to the first element to access other parts of the array.

Uploaded by

Suraj Kundu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views1 page

Address Manipulation

This C++ program demonstrates address manipulation in a 2D array. It declares a 3x5 integer array initialized with values from 1 to 15. It then uses pointer arithmetic on the array to access and print out various elements, such as the element after the last in the second row, the third element in the second column, and using a pointer to the first element to access other parts of the array.

Uploaded by

Suraj Kundu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

15.

PROGRAMME TO ILLUSTRATE ADDRESS


MANIPULATION IN A 2-D ARRAY

#include<iostream.h>
#include<conio.h>
void main()
{int x[3][5]={{1,2,3,4,5},{6,7,8,9,10},{11,12,13,14,15}};
int *n=&x[0][0];
cout<<"1.*(*(x+2)+1)\t="<<*(*(x+2)+1)<<endl;
cout<<"2.*(*(x+2)+5)\t="<<*(*(x+2)+5)<<endl;
cout<<"3.*(*(x+1))\t="<<*(*(x+1))<<endl;
cout<<"4.*(*(x)+2)+1\t="<<*(*(x)+2)+1<<endl;
cout<<"5.*(*(x+1)+3)\t="<<*(*(x+1)+3)<<endl;
cout<<"6.*n\t\t="<<*n<<endl;
cout<<"7.*(n+2)\t="<<*(n+2)<<endl;
cout<<"8.(*(n+3)+1)\t="<<(*(n+3)+1)<<endl;
cout<<"9.*(n+5)+1\t="<<*(n+5)+1<<endl;
cout<<"10.++*n\t="<<++*n<<endl;
getch();
return 0;
}

You might also like