Guest User

Try 3

a guest
Sep 21st, 2013
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. /*
  2. Function with Parameter.c
  3.  
  4. Version 0.94 for use with SimpleIDE 9.40 and its Simple Libraries
  5.  
  6. Call a function that displays a value passed to it with a parameter.
  7.  
  8. http://learn.parallax.com/propeller-c-functions/function-parameter
  9. */
  10.  
  11. #include "simpletools.h" // Include simpletools
  12.  
  13. void counter(int startVal, int endVal, int incVal); // Function prototype
  14.  
  15. int main() // main function
  16. {
  17. counter(0, 8, 2);
  18.  
  19. }
  20.  
  21. void counter(int startVal, int endVal, int incVal) // value function
  22. {
  23. for(int i = startVal; i <= endVal; i = i + incVal)
  24. {
  25. print("Value = %d\n", i); // Display a single value
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment