This program needs to delete the comments in another c program. So what I tried to do was just copy it to a new file.
my problem is that I'm not sure how exactly to call it, I don't know if i'm doing that part right. When I run the program it doesn't do anything and I can't exit the terminal. Please help!!Code:#include <stdio.h> void filecopy(FILE *, FILE *); main() { FILE *fin; FILE *fout; fin=fopen("attempt4.c","r"); if((fout=fopen("pw.c","w"))==NULL) printf("GERRRRR"); else filecopy(fin,fout); fclose(fin); return 0; } void filecopy(FILE *ifp, FILE *ofp) { int c; int prevc; while((c=getc(ifp))!=EOF) { if(prevc='/') //look for first char of a comment if(c='/') //find second one { while(c !='\n') { //do nothing } } else if(c='*') // find /* incase it is blocked { /* doesn't stop until it finds end of comment */ while(prevc !='*' && c!='/') { //do nothing } } else //copy the rest to the other file { putc(c,ofp); prevc=getc(ifp); } } }