I am looking for an example of recursion to flatten a table of key-value pairs were some values are also keys. The code below, which is offered only for guidance, results in an incomplete output:
The expected result, which is not accomplished by the sample code since it its not a recursion, should be this:
The desired output is expected in the order in which the values are found.
int main(int argc, char *argv[])
{
uint8_t c = 0;
uint8_t d = 0;
uint8_t p[8][2] = {15,1,
15,2,
16,15,
16,3,
17,4,
17,5,
18,16,
18,17};
for(c = 0;c < 8;c++) {
for(d = 0;d < 8;d++) {
if(p[7 - c][1] == p[7 - d][0]) {
printf("%hhu %hhu %hhun",p[7 - c][0],p[7 - c][1],p[7 - d][1]);
}
}
}
return 0;
}