#include <stdio.h>
#include <string.h>

void remove_comment(char *s1, char *s2) {

  for(int in_comment=0; *s1 ; s1++){  //loops through array until null value
    if(!in_comment && *s1 == '/' && s1[1]=='*') {  //if array has '/' stored
        in_comment=1; 
        s1++; 
    }
    else if (in_comment) {
    	if (*s1=='*' && s1[1]=='/') {
    		in_comment = 0; 
    		s1++;
    	}
    }
    else *s2++=*s1;
  }
  *s2='\0';
}

int main()
{
	char s1[101]; //declares arrays up to 100 in length with room for null character
	char s2[101];

	printf("Enter a comment: "); //enter a comment
	gets(s1);  // saves comment to array
	printf ("'%s'\n",s1);

	remove_comment(s1,s2);  //calls function
	printf ("-> '%s'\n",s2);
	return 0;
}
