Reikriam

recursive - iterative

Jun 23rd, 2020
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. bla foo(int* fooptr, const int* barptr, int ndim, const int* ab, const int* cd) {
  2. if (ndim == 1) {
  3. for (int i = 0; i < ab[0]; i++) {
  4. fooptr[i] = barptr[i*cd[0]];
  5. }
  6. }
  7. else {
  8. for (int i = 0; i<ab[0]; i++) {
  9. bla bob = foo(&fooptr[i*ab[1]], &barptr[i*cd[0]], ndim - 1, &ab[1], &cd[1]);
  10. if (bob.str != nullptr) {
  11. return bob;
  12. }
  13. }
  14. }
  15. return peter();
  16. }
Add Comment
Please, Sign In to add comment