All pastes #392917 Raw Edit

Something

public text v1 · immutable
·published 2007-03-13 05:05 UTC
rendered paste body
#include <stdio.h>

/* remove comments from C source */
main()
{
        char c, lc;
        int incom;

        while ((c = getchar()) != EOF) {
                printf("while c = %c\n",c);
                if (!(c == '/') && (incom == 1)) {
                        printf("L%cC:%c\n", lc, c);
                        if (lc == '*' && c == '/') {
                                incom = 0;
                                printf("HIIIIIIIIIIIIIIIIIII");
                        }
                }
                 else if (lc == '/' && c == '*') {
                        incom = 1;
                }
                else if (lc =='/' && incom == 0) {

                        printf("else if %c\n", c);
                }
                else {
                        incom = 0;
                        printf("else %c\n", c);
                }
                lc = c;
        }
}