C++ How to declare pointer to 2D array -


this question has answer here:

i have portion of code goes (assume types int):

for(int = 0; < h; ++i) {     for(int = 0; < h; ++i)     {         if(...)         {              = b[i][j]         }         else         {              = c[i][j]         }     } } 

i write check if condition once. how go in declaring pointer 2d array adequately (variable d in example below) ?

if(...) {     d = b; } else {     d = c; }  for(int = 0; < h; ++i) {     for(int = 0; < h; ++i)     {         = d[i][j]     } } 

combining @madsciencedreams' answer , @grijesh chauhan comment, following seems work:

double a[1000][1000]; double (*b)[1000][1000] = &a; 

and access value:

double = (*b)[i][j]; 

Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -