Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Ex 4 . 1 0 , 1 1 : Replace C 9 9 comments The original 1 9 8 9 ANSI / 1 9 9

Ex4.10,11: Replace C99 comments
The original 1989 ANSI /1990 ISO C standard (ANSI C, C90) only permits /**/ style comments:
??** This is a comment **?
??** This is
a multiline comment */
The 1999 ISO standard (C99) provides line-oriented comments starting with a // combination:
Task
Starting with the program fortcomm.c shown in Figure 4.13 on page 58(also found in "Reading
data with loops"), write a program that replaces each c99-style comment in the input text by an
equivalent ANSI C comment.
That is, each // pair that commences a comment should be replaced by ??***, and then a */
combination should be inserted immedlately prior to the next newline character.
Sample output
The program should not prompt for input. Any input given to it should be outputted with C99-style
comments being replaced with ANSI C comments.
// My useful program
#include stdio.h>
int main() Our main function */
printf("Hello world! {:?
?n);????? print hello
// done, phew!
return
}
bash$ ./program input.c
??** My useful program */
#include {:?
?n);**a**???????******************************???{:?
?n);**?????????***??*********************************???**:?*
?n*;???
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 23rd International Conference Dexa 2012 Vienna Austria September 2012 Proceedings Part 1 Lncs 7446

Authors: Stephen W. Liddle ,Klaus-Dieter Schewe ,A Min Tjoa ,Xiaofang Zhou

2012th Edition

3642325998, 978-3642325991

More Books

Students also viewed these Databases questions

Question

4. Describe the factors that influence self-disclosure

Answered: 1 week ago

Question

1. Explain key aspects of interpersonal relationships

Answered: 1 week ago