2D Array method in c++ - declaration of array must have bounds Catch-22 -


i've been doing problem involves rotating square arrays in c++. length of array in 'len'. however, these rotate , flip methods return 2d array , need 2d array arguments. compiler gives me error:

error: declaration of 'a' multidimensional array must have bounds dimensions except first.

however, size of array depends on input - , when have input 'len' , declare method, gives me old 'variable not declared in scope' problem.

pretty much, can't length of array because changes depending on input.

is there way past this?

#include <iostream>           #include <fstream> #include <cmath>  using namespace std;  class transform{ private:     int len; public:     bool rot90[][](bool a[][]);     bool rot180[][] (bool a[][]);     bool check (bool a[][], bool b[][]);     bool rot270[][] (bool a[][]);     bool flip[][] (bool a[][]); };  bool transform::check(bool a[len][len], bool b[len][len]){     for(int h=0; h<len; h++){         for(int w=0; w<len; w++){             if(a[h][w] != b[h][w])                 return false;         }     }     return true; }   bool transform::rot90[len][len] (bool a[len][len]){     bool[len][len] b;     for(int h=0; h<len; h++){         for(int w<0; w<len; w++){             b[w][len-1-h] = a[h][w];         }     }     return b; }  bool transform::rot270[len][len] (bool a[len][len]){     bool[len][len] b;     for(int h=0; h<len; h++){         for(int w<0; w<len; w++){             b[len-1-w][h] = a[h][w];         }     }     return b; }  bool transform::flip[len][len] (bool a[len][len]){     bool[len][len] b;     for(int h=0; h<len; h++){         for(int w<0; w<len; w++){             b[h][len-1-w] = a[h][w];         }     }     return b; } 

... code continues


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo