Accessing the last element on a row in a 2D array that is in a structure

I'm attempting to access the last element on each row of a 2D array that is inside a structure. I'm, attempting to determine if a specific character is in that position, but I can't figure out how to access that specific element.

My unfinished code:

typedef struct node {
   char grid[MAXGRIDHW][MAXGRIDHW];
   int height;
   int width;
   int parent;
} Node;

bool emptyEnd (Node *b)
{
   int x, y;
   char lastEle = ;

   for (y = 0; y <= b->height; y++) {
      for (x = 0; x <= b->width; x++) {
         if (lastEle == '-') {
            return true;
         } else {
            return false;
         }
      }
   }
}


Read more here: https://stackoverflow.com/questions/64945175/accessing-the-last-element-on-a-row-in-a-2d-array-that-is-in-a-structure

Content Attribution

This content was originally published by Davospike at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: