'how to store x,y position of letter(of word) in 2D grid

I want to store x,y position of my found word in a 2D grid(10x10 grid)

bonehwkcom
vurizleftl
edebaindex
ronlsgavth
twcixeorie
inakfzanch
cidrawkcab
aordnmawll
leuzsiqxak
eordsearch
wordsearch

Word bone found at: (0,0), (0,1), (0,2), (0,3). (This is what I want to store but don't know how)

How would I store x and y as once the letter is validated?

I need to store them because once I've found the word, I'll convert its lowercase letters to uppercase.

I was thinking of saving it in an pointer *key. is there a better easier way?



Solution 1:[1]

One way

 // struct to hold co-ords
 struct cell{
      int x;
      int y;
 }
 ....
 char *foundWord = "bone";
 // create array of cell large enough for the word
 struct cell *wordLoc = malloc(sizeof(struct cell) * strlen(foundWord));
 ...
 // fill array 
 wordLoc[0].x = 0;
 wordLoc[0].y = 0;
 wordLoc[1].x = 0;
 wordLoc[1].y = 1;

etc

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 pm100