History of Idiom 20 > diff from v7 to v8
Edit summary for version 8 by :
↷
Version 7
2015-08-19, 17:37:37
Version 8
2015-08-20, 10:48:55
Idiom #20 Return two values
Implement a function search which looks for item x in a 2D matrix m.
Return indices i, j of the matching cell.
Think of the most idiomatic way in the language to return the two values at the same time.
Idiom #20 Return two values
Implement a function search which looks for item x in a 2D matrix m.
Return indices i, j of the matching cell.
Think of the most idiomatic way in the language to return the two values at the same time.
Comments bubble
x is the pointer to the data to look for
memb_size is the size of one element in bytes (to be able to compare anything)
len_x and len_y are the dimensions
i and j are passed by reference and contain the values, or -1 if x was not found, after the function returned.