我想将我找到的单词的x,y位置存储在2D网格(10x10网格(中
bonehwkcom
vurizleftl
edebaindex
ronlsgavth
twcixeorie
inakfzanch
cidrawkcab
aordnmawll
leuzsiqxak
eordsearch
wordsearch
在以下位置找到单词骨骼:(0,0(、(0,1(,(0,2(、(0,3((这是我想存储但不知道如何存储的(
一旦验证了字母,我将如何存储x和y?
我需要存储它们,因为一旦找到单词,我就会将其小写字母转换为大写字母
我想把它保存在一个指针键中。有更简单的方法吗?
单向
// 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