1

I want to assign matris to pointer and print it. but i can't. Code doesn't work. Give this error "Documents\Untitled4.cpp [Error] cannot convert 'int (*)[2][2]' to 'int**' in initialization" How can i print like this **p[i][j]?

#include<stdio.h>


int main (int argc,const char * argv[]){
    int matrix [2][2]={{1,2},{3,4}};
    int **p=&matrix;
    int i,j;
    for(i=0;i<2;i++)
    {
        for(j=0;j<2;j++)
        {
            printf("%d",p[i][j]);
        }
    }


    return 0;
}
Scheff's Cat
  • 19,528
  • 6
  • 28
  • 56
Ahmet Ufuk
  • 11
  • 3

0 Answers0