I am trying to declare a 3D array and store value into the 3D array using pointer. But I can get the inputs using scanf but the output always prints the address instead of the value of the array. Below is my code. What am I doing wrong here?
#include <stdio.h>
void main()
{
int b[3][3][3];
int l1,l2,l3;
int *pa2[3][3];
pa2[3][3]=b;
for(l1=0;l1<3;l1++)
{
for(l2=0;l2<3;l2++)
{
for(l3=0;l3<3;l3++)
{
scanf("%d",(((pa2+l1)+l2)+l3));
}
}
}
for(l1=0;l1<3;l1++)
{
for(l2=0;l2<3;l2++)
{
for(l3=0;l3<3;l3++)
{
printf("%d\n",*(((pa2+l1)+l2)+l3));
}
}
}
}