Implement a C-formatter program that re-renders multi-line C-style comments as per the following cases.
/* This is a multi-line comment. This is line 1.
* This is line 2. This is line 3 */should be rendered as:
/* * This is a multi-line comment. This is line 1. * This is line 2. * This is line 3 */
The following code segment,
int magic_number = 0; /* This implements a magic numberfor the data structure */
should be rendered as
/*
* This implements a magic number * for the data structure. */int magic_number = 0;
Your code can assume that input will not have opening comment /* within string literals. For example ” this is a /* within a literal “. Your code can also assume that input will not have nested comments.
248 Views |
No comments yet.