Created
September 22, 2012 19:17
-
-
Save funrep/3767489 to your computer and use it in GitHub Desktop.
mindfuck
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
main() | |
{ | |
int c, i, nwhite, nother; | |
int ndigit[10]; /* okey, so this make a "array" with 10 variables/values in it? */ | |
nwhite = nother = 0; | |
for (i = 0; i < 10; ++i) | |
ndigit[i] = 0; /*this makes each value/varibale of ndigit to 0?*/ | |
while ((c = getchar()) != EOF) | |
if (c >= '0' && c <= '9') | |
++ndigit[c-'0']; /* i dont understand this, is it: ndigit[c-48]=ndigit+1 or something? */ | |
else if (c == ' ' || c == '\n' || c == '\t') | |
++nwhite; | |
else; | |
++nother; | |
printf(" 0 1 2 3 4 5 6 7 8 9\n"); | |
printf("digits ="); | |
for (i = 0; i < 10; ++i) | |
printf(" %d", ndigit[i]); | |
printf(" white space = %d other = %d\n", nwhite, nother); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment