studyhubSettings

Settings

How C code is coloured and set, everywhere on the site. Changes apply as you make them and are kept on this device.

How it looks

  1. 1#include <stdio.h>
  2. 2#define MAX 6
  3. 3
  4. 4// Add up the digits of n.
  5. 5int sumDigits(int n) {
  6. 6 int sum = 0;
  7. 7 while (n > 0) {
  8. 8 sum += n % 10; (just ran)
  9. 9 n /= 10; (runs next)
  10. 10 }
  11. 11 return sum;
  12. 12}
  13. 13
  14. 14int main(void) {
  15. 15 int n;
  16. 16 char *label = "Sum: ";
  17. 17 scanf("%d", &n);
  18. 18 if (n < 0 || n > MAX * 1000) return 1;
  19. 19 printf("%s%d\n", label, sumDigits(n));
  20. 20 return 0;
  21. 21}

Code colours

The roles an editor uses, with no green or red: those two still mean right and wrong here.

  • Keywords

    #7fb4ff
  • Types

    #62d0e0
  • Functions

    #e6d88a
  • Names

    #dcdcdc
  • Numbers and constants

    #cfa8ff
  • Strings

    #e3a577
  • Escapes and placeholders

    #ffd0a8
  • Preprocessor

    #e08fc4
  • Comments

    #959bb6
  • Operators and brackets

    #b4b9d0

Code font

Ligatures are off in every face: != stays two characters, the way you type it.