fork(1) download
  1. #include <stdio.h>
  2. #include <stdint.h>
  3.  
  4. #define ARR_L 11
  5. #define INS_P (arr[0])
  6. #define MOD_L(a) ((a) % ARR_L)
  7. #define INS_P_M (MOD_L(INS_P))
  8. #define ARR_ACS(a) (arr[MOD_L(a)]) //access to arr
  9.  
  10.  
  11. void foo (uint8_t *arr)
  12. {
  13. if (ARR_ACS(0) == 0)
  14. {
  15. printf("%u ", ARR_ACS(1));
  16. ARR_ACS(1) += ARR_ACS(2);
  17. ARR_ACS(0) = 1;
  18. }
  19. else
  20. {
  21. printf("%u ", ARR_ACS(2));
  22. ARR_ACS(2) += ARR_ACS(1);
  23. ARR_ACS(0) = 0;
  24. }
  25.  
  26. }
  27.  
  28. int main(void) {
  29. uint8_t arr[ARR_L] = {1,1,1,0,0,0,0,0,0,0,0};
  30. for (size_t a = 0; a < 13; a++)
  31. {
  32. foo(arr);
  33. }
  34. return 0;
  35. }
Success #stdin #stdout 0s 2292KB
stdin
Standard input is empty
stdout
1 1 2 3 5 8 13 21 34 55 89 144 233