Professional Documents
Culture Documents
FILE *FI,*FO;
char ch;
FI=fopen("file1.c","r");
FO=fopen("output.c","w");
ch=getc(FI);
while(ch!=EOF){
if(ch=='/'){
ch=getc(FI);
if(ch=='/'){
while(ch!='\n') //while loop{
ch=getc(FI);
}
}
if(ch=='*'){
while(ch!=EOF){
ch=getc(FI);
if(ch=='*'){
ch=getc(FI);
if(ch=='/')
break;
}
}
}
ch=getc(FI);
}
putc(ch,FO);
ch=getc(FI);
}
close(FI);
close(FO);
}
Output:
In Output comments will be removed from file.c
#include<stdio.h>
void main(){
printf(“Hello World ”);
}
160110107007 Page 1