0

Hey everyone i need some help :( I have struct in my file like this

    typedef struct{
    uint16_t n; //x axis
    uint16_t m; //y axis
    uint8_t value;
    uint8_t finished;
}one_element;

Now in main.c i have something like this

one_element loaded[8][10];

I am passing to function bfs loaded matrix from main like this

bfs(loaded);

And my bfs function is declared like this:

void bfs(one_element* loaded[]);

And in bfs function i want to set field for specific struct at some position, for example 0 and 0 (top left element)

one_element from_queue;
from_queue = ((*getFromQueue)(&myQueue));
loaded[from_queue.m][from_queue.n].finished = 1;

I now for sure that indexes are good (from_queue.m and from_queue.n) i checked that in debbuger, also i dont have any errors, but i got segmentation fault when executing

loaded[from_queue.m][from_queue.n].finished = 1;

So what is problem, what am i doing wrong?

Thanks PS: This is first problem for which i had to made account :D I hope someone can help :D

Gvex95
  • 11
  • 3

0 Answers0