Advertisement
fsb4000

C from Vala

Jul 17th, 2020
1,063
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.00 KB | None | 0 0
  1. /* main.c generated by valac 0.48.7, the Vala compiler
  2.  * generated from main.vala, do not modify */
  3.  
  4. #include <glib.h>
  5. #include <float.h>
  6. #include <math.h>
  7. #include <stdio.h>
  8.  
  9. void factorial (guint32 n,
  10.                 gdouble* _result_);
  11. void _vala_main (void);
  12.  
  13. void
  14. factorial (guint32 n,
  15.            gdouble* _result_)
  16. {
  17.     gdouble _vala__result_ = 0.0;
  18.     if (n <= ((guint32) 1)) {
  19.         _vala__result_ = 1.0;
  20.     } else {
  21.         gdouble partial_result = 0.0;
  22.         guint32 next_n = 0U;
  23.         gdouble _tmp0_ = 0.0;
  24.         next_n = n - 1;
  25.         factorial (next_n, &_tmp0_);
  26.         partial_result = _tmp0_;
  27.         _vala__result_ = n * partial_result;
  28.     }
  29.     if (_result_) {
  30.         *_result_ = _vala__result_;
  31.     }
  32. }
  33.  
  34. void
  35. _vala_main (void)
  36. {
  37.     gdouble _result_ = 0.0;
  38.     guint32 n = 0U;
  39.     gdouble _tmp0_ = 0.0;
  40.     FILE* _tmp1_;
  41.     n = (guint32) 5;
  42.     factorial (n, &_tmp0_);
  43.     _result_ = _tmp0_;
  44.     _tmp1_ = stdout;
  45.     fprintf (_tmp1_, "%g\n", _result_);
  46. }
  47.  
  48. int
  49. main (int argc,
  50.       char ** argv)
  51. {
  52.     _vala_main ();
  53.     return 0;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement