fork download
  1. #include<stdio.h>
  2.  
  3. void rcomment(int c);
  4. void incomment(void);
  5. void echo_quote(int c);
  6.  
  7. int main(void)
  8. {
  9. int c,d;
  10.  
  11. printf(" To Check /* Quoted String */ \n");
  12.  
  13. while((c=getchar())!=EOF)
  14. rcomment(c);
  15.  
  16. return 0;
  17. }
  18.  
  19. void rcomment(int c)
  20. {
  21. int d;
  22. if( c == '/')
  23. {
  24. if((d=getchar())=='*')
  25. incomment();
  26. else if( d == '/')
  27. {
  28. putchar(c);
  29. rcomment(d);
  30. }
  31. else
  32. {
  33. putchar(c);
  34. putchar(d);
  35. }
  36. }
  37. else if( c == '\''|| c == '"')
  38. echo_quote(c);
  39. else
  40. putchar(c);
  41. }
  42.  
  43. void incomment()
  44. {
  45. int c,d;
  46.  
  47. c = getchar();
  48. d = getchar();
  49.  
  50. while(c!='*' || d !='/')
  51. {
  52. c =d;
  53. d = getchar();
  54. }
  55. }
  56.  
  57. void echo_quote(int c)
  58. {
  59. int d;
  60.  
  61. putchar(c);
  62.  
  63. while((d=getchar())!=c)
  64. {
  65. putchar(d);
  66.  
  67. if(d = '\\')
  68. }
  69. putchar(d);
  70. }
Success #stdin #stdout 0s 2172KB
stdin
Standard input is empty
stdout
 To Check /* Quoted String */