PageRenderTime 26ms CodeModel.GetById 0ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/mzscheme/simple/example.c

#
C | 24 lines | 14 code | 6 blank | 4 comment | 2 complexity | 92f0e6c6da86d43b8f31dcd5671aaf09 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. /* Simple example from documentation */
  2. /* File : example.c */
  3. #include <time.h>
  4. double My_variable = 3.0;
  5. /* Compute factorial of n */
  6. int fact(int n) {
  7. if (n <= 1) return 1;
  8. else return n*fact(n-1);
  9. }
  10. /* Compute n mod m */
  11. int my_mod(int n, int m) {
  12. return (n % m);
  13. }
  14. char *get_time() {
  15. long ltime;
  16. time(&ltime);
  17. return ctime(&ltime);
  18. }