fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4.  
  5. /* constants */
  6. #define ON 1
  7. #define OFF 0
  8.  
  9. int light_switch = ON; /* simulates a light switch */
  10.  
  11. /* Check to see if the lights are on */
  12. if (light_switch)
  13. printf ("The Lights are ON\n");
  14.  
  15. switch (light_switch)
  16. {
  17. case ON:
  18. printf("The Lights are ON\n");
  19. break;
  20. case OFF:
  21. printf("The Lights are OFF\n");
  22. break;
  23.  
  24. } /* switch */
  25.  
  26. return 0;
  27. }
  28.  
Success #stdin #stdout 0s 5316KB
stdin
OFF
stdout
The Lights are ON
The Lights are ON