I have a 15x15 array which I have to traverse with pointers (hw ). I'm writing a puzzle solver and I need to search some words vertically,I've done horizontal search but I can't traverse the array column by column.I am trying to assign ptr to tmp each time after tmp reached the end of column.
void VerticalSearch(char** puzzleArray, searchedWord* word) {
int len = word->wordLength;
char **tmp = puzzleArray;
char *ptr = &puzzleArray[0][0];
string s;
for (int i = 0; i < 15; i++) {
**tmp = *ptr;
s = "";
for (int k = 0; k < 15; k++)
{
s += **tmp;
(tmp)++;
}
cout << s << endl;
ptr++;
}
}