program for accessing a array using pointer

Go4Expert Member
18Dec2007,10:12   #1
bashamsc's Avatar
Code: C
#include<iostream.h>
main()
{
int* a;int arr[2][3];

arr[0][0]=1;
arr[0][1]=2;
arr[0][2]=3;
arr[1][0]=4;
arr[1][1]=5;
arr[1][2]=6;

a = &arr[0][0];


int i,j;

for(i=0;i<2;i++)
{
for(j=0;j<3;j++)
{
cout<<*(a+j)<<endl;
}
a=a+3;
}
}

Last edited by shabbir; 18Dec2007 at 17:53.. Reason: Code block
Go4Expert Founder
18Dec2007,17:54   #2
shabbir's Avatar
Instead of using the color block around the code use the code block.
Ambitious contributor
18Dec2007,19:35   #3
Salem's Avatar
Was there a question in there?
It's just code, no explanation, no questions, nothing, nada, zip, zilch.