Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- main()
- {
- int IN, OUT,c, i,state,l,w[0];
- IN=1;
- OUT=0;
- state = IN;
- i=1;
- w[i-'0']=0;
- printf("w[i] before while %d\n", w[i-'0']);
- while ((c = getchar()) != EOF) {printf("w[%d] before 1st if=%d state=%d\n",i, w[i],state);
- if (c == ' ' || c == '\n' || c == '\t'){printf("w[%d]after 1st if %d\n",i, w[i-'0']);
- state = OUT;}
- else if (state==IN){++w[i];printf("w[%d] after ++w[%d]=%d\n",i,i, w[i]);}
- else if (state == OUT) {
- state = IN;
- ++i;
- w[i-'0']=0;
- }}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement